diff --git a/.github/workflows/sdk_generation.yaml b/.github/workflows/sdk_generation.yaml index 65342d7..ee6b38e 100644 --- a/.github/workflows/sdk_generation.yaml +++ b/.github/workflows/sdk_generation.yaml @@ -19,11 +19,56 @@ permissions: - cron: 0 0 * * * jobs: generate: - uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15 - with: - force: ${{ github.event.inputs.force }} - mode: pr - set_version: ${{ github.event.inputs.set_version }} - secrets: - github_access_token: ${{ secrets.GITHUB_TOKEN }} - speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }} + runs-on: ubuntu-latest + steps: + - name: Clone SDK repo + uses: actions/checkout@v3 + + - name: Set up SSH + env: + SSH_AUTH_SOCK: /tmp/ssh_agent.sock + run: | + mkdir -p ~/.ssh + ssh-keyscan github.com >> ~/.ssh/known_hosts + echo "${{ secrets.FH_OPS_SSH_KEY }}" > ~/.ssh/id_ed25519 + chmod 400 ~/.ssh/id_ed25519 + ssh-agent -a $SSH_AUTH_SOCK > /dev/null + ssh-add ~/.ssh/id_ed25519 + + - name: Clone developers repo + env: + SSH_AUTH_SOCK: /tmp/ssh_agent.sock + run: | + git clone git@github.com:firehydrant/developers.git /tmp/dev-repo + cd /tmp/dev-repo + git checkout main + + - name: Copy OpenAPI spec + run: | + cp /tmp/dev-repo/docs/public/openapi3_doc.json ${GITHUB_WORKSPACE}/openapi-raw.json + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: 'stable' + + - name: Process OpenAPI spec + run: | + # Normalize the schema + go run ./scripts/normalize openapi-raw.json openapi.json + + # Generate Terraform overlay + go run ./scripts/overlay openapi.json ./scripts/overlay/manual-mappings.yaml + + # Move overlay to Speakeasy directory + mkdir -p .speakeasy + mv terraform-overlay.yaml .speakeasy/ + + - name: Generate SDK + uses: speakeasy-api/sdk-generation-action@v15 + with: + force: ${{ github.event.inputs.force }} + mode: pr + set_version: ${{ github.event.inputs.set_version }} + github_access_token: ${{ secrets.GITHUB_TOKEN }} + SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }} \ No newline at end of file diff --git a/.github/workflows/terraform_publish.yaml b/.github/workflows/terraform_publish.yaml deleted file mode 100644 index 777f66a..0000000 --- a/.github/workflows/terraform_publish.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Terraform Provider release workflow. -name: Release - -# This GitHub action creates a release when a tag that matches the pattern -# "v*" (e.g. v0.1.0) is created. -on: - push: - tags: - - 'v*' - workflow_dispatch: - -# Releases need permissions to read and write the repository contents. -# GitHub considers creating releases and uploading assets as writing content. -permissions: - contents: write - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - with: - # Allow goreleaser to access older tag information. - fetch-depth: 0 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 - with: - go-version-file: 'go.mod' - cache: true - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0 - id: import_gpg - with: - gpg_private_key: ${{ secrets.terraform_gpg_secret_key }} - passphrase: ${{ secrets.terraform_gpg_passphrase }} - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 - with: - args: release --clean - env: - # GitHub sets the GITHUB_TOKEN secret automatically. - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} diff --git a/.github/workflows/tf_provider_release.yaml b/.github/workflows/tf_provider_release.yaml index 9b34024..3f25724 100644 --- a/.github/workflows/tf_provider_release.yaml +++ b/.github/workflows/tf_provider_release.yaml @@ -15,22 +15,22 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: # Allow goreleaser to access older tag information. fetch-depth: 0 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: 'go.mod' cache: true - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0 + uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0 id: import_gpg with: gpg_private_key: ${{ secrets.terraform_gpg_private_key }} passphrase: ${{ secrets.terraform_gpg_passphrase }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 + uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 with: args: release --clean env: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 1d4df21..7fc59cc 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -1,24 +1,42 @@ configVersion: 2.0.0 generation: + devContainers: + enabled: true + schemaPath: registry.speakeasyapi.dev/firehydrant/firehydrant/firehydrant-oas:main sdkClassName: firehydrant maintainOpenAPIOrder: true usageSnippets: optionalPropertyRendering: withExample + sdkInitStyle: constructor useClassNamesForArrayFields: true fixes: nameResolutionDec2023: true + nameResolutionFeb2025: true parameterOrderingFeb2024: true requestResponseComponentNamesFeb2024: true + securityFeb2025: false + sharedErrorComponentsApr2025: false auth: oAuth2ClientCredentialsEnabled: true + oAuth2PasswordEnabled: true terraform: - version: 0.1.5 + version: 0.2.6 additionalDataSources: [] additionalDependencies: {} + additionalEphemeralResources: [] + additionalProviderAttributes: + httpHeaders: "" + tlsSkipVerify: "" additionalResources: [] allowUnknownFieldsInWeakUnions: false author: firehydrant defaultErrorName: APIError enableTypeDeduplication: false environmentVariables: [] + operationIdNaming: preserve packageName: firehydrant + providerGeneration: + enabled: true + resourceDetection: + strategy: operationId + tagStrategy: ignore diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 82140d3..c2644ab 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -3,9 +3,9 @@ speakeasyVersion: latest sources: firehydrant-oas: inputs: - - location: ./openapi.yaml + - location: ${GITHUB_WORKSPACE}/openapi.json overlays: - - location: .speakeasy/speakeasy-suggestions.yaml + - location: ./.speakeasy/terraform-overlay.yaml registry: location: registry.speakeasyapi.dev/firehydrant/firehydrant/firehydrant-oas targets: diff --git a/README.md b/README.md index d6df51f..09521df 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,121 @@ Developer-friendly & type-safe Terraform SDK specifically catered to leverage *f ## Summary +FireHydrant API: The FireHydrant API is based around REST. It uses Bearer token authentication and returns JSON responses. You can use the FireHydrant API to configure integrations, define incidents, and set up webhooks--anything you can do on the FireHydrant UI. +* [Dig into our API endpoints](https://developers.firehydrant.io/docs/api) +* [View your bot users](https://app.firehydrant.io/organizations/bots) + +## Base API endpoint + +[https://api.firehydrant.io/v1](https://api.firehydrant.io/v1) + +## Current version + +v1 + +## Authentication + +All requests to the FireHydrant API require an `Authorization` header with the value set to `Bearer {token}`. FireHydrant supports bot tokens to act on behalf of a computer instead of a user's account. This prevents integrations from breaking when people leave your organization or their token is revoked. See the Bot tokens section (below) for more information on this. + +An example of a header to authenticate against FireHydrant would look like: + +``` +Authorization: Bearer fhb-thisismytoken +``` + +## Bot tokens + +To access the FireHydrant API, you must authenticate with a bot token. (You must have owner permissions on your organization to see bot tokens.) Bot users allow you to interact with the FireHydrant API by using token-based authentication. To create bot tokens, log in to your organization and refer to the **Bot users** [page](https://app.firehydrant.io/organizations/bots). + +Bot tokens enable you to create a bot that has no ties to any user. Normally, all actions associated with an API token are associated with the user who created it. Bot tokens attribute all actions to the bot user itself. This way, all data associated with the token actions can be performed against the FireHydrant API without a user. + +Every request to the API is authenticated unless specified otherwise. + +### Rate Limiting + +Currently, requests made with bot tokens are rate limited on a per-account level. If your account has multiple bot token then the rate limit is shared across all of them. As of February 7th, 2023, the rate limit is at least 50 requests per account every 10 seconds, or 300 requests per minute. + +Rate limited responses will be served with a `429` status code and a JSON body of: + +```json +{"error": "rate limit exceeded"} +``` +and headers of: +``` +"RateLimit-Limit" -> the maximum number of requests in the rate limit pool +"Retry-After" -> the number of seconds to wait before trying again +``` + +## How lists are returned + +API lists are returned as arrays. A paginated entity in FireHydrant will return two top-level keys in the response object: a data key and a pagination key. + +### Paginated requests + +The `data` key is returned as an array. Each item in the array includes all of the entity data specified in the API endpoint. (The per-page default for the array is 20 items.) + +Pagination is the second key (`pagination`) returned in the overall response body. It includes medtadata around the current page, total count of items, and options to go to the next and previous page. All of the specifications returned in the pagination object are available as URL parameters. So if you want to specify, for example, going to the second page of a response, you can send a request to the same endpoint but pass the URL parameter **page=2**. + +For example, you might request **https://api.firehydrant.io/v1/environments/** to retrieve environments data. The JSON returned contains the above-mentioned data section and pagination section. The data section includes various details about an incident, such as the environment name, description, and when it was created. + +``` +{ + "data": [ + { + "id": "f8125cf4-b3a7-4f88-b5ab-57a60b9ed89b", + "name": "Production - GCP", + "description": "", + "created_at": "2021-02-17T20:02:10.679Z" + }, + { + "id": "a69f1f58-af77-4708-802d-7e73c0bf261c", + "name": "Staging", + "description": "", + "created_at": "2021-04-16T13:41:59.418Z" + } + ], + "pagination": { + "count": 2, + "page": 1, + "items": 2, + "pages": 1, + "last": 1, + "prev": null, + "next": null + } +} +``` + +To request the second page, you'd request the same endpoint with the additional query parameter of `page` in the URL: + +``` +GET https://api.firehydrant.io/v1/environments?page=2 +``` + +If you need to modify the number of records coming back from FireHydrant, you can use the `per_page` parameter (max is 200): + +``` +GET https://api.firehydrant.io/v1/environments?per_page=50 +``` ## Table of Contents + +* [Firehydrant Terraform Provider V2](#firehydrant-terraform-provider-v2) + * [Base API endpoint](#base-api-endpoint) + * [Current version](#current-version) + * [Authentication](#authentication) + * [Bot tokens](#bot-tokens) + * [How lists are returned](#how-lists-are-returned) + * [Installation](#installation) + * [Available Resources and Data Sources](#available-resources-and-data-sources) + * [Testing the provider locally](#testing-the-provider-locally) +* [Development](#development) + * [Contributions](#contributions) +* [terraform-provider-firehydrant-v2](#terraform-provider-firehydrant-v2) -* [Installation](#installation) -* [Available Resources and Data Sources](#available-resources-and-data-sources) -* [Testing the provider locally](#testing-the-provider-locally) @@ -33,7 +139,7 @@ terraform { required_providers { firehydrant = { source = "firehydrant/firehydrant" - version = "0.1.5" + version = "0.2.7" } } } @@ -49,50 +155,54 @@ provider "firehydrant" { ### Resources -* [firehydrant_checklist_template](docs/resources/checklist_template.md) -* [firehydrant_environment](docs/resources/environment.md) -* [firehydrant_functionality](docs/resources/functionality.md) -* [firehydrant_incident_role](docs/resources/incident_role.md) -* [firehydrant_incident_type](docs/resources/incident_type.md) -* [firehydrant_priority](docs/resources/priority.md) -* [firehydrant_runbook](docs/resources/runbook.md) -* [firehydrant_service](docs/resources/service.md) -* [firehydrant_service_dependency](docs/resources/service_dependency.md) -* [firehydrant_severity](docs/resources/severity.md) -* [firehydrant_status_update_template](docs/resources/status_update_template.md) -* [firehydrant_task_list](docs/resources/task_list.md) -* [firehydrant_team](docs/resources/team.md) -* [firehydrant_webhook](docs/resources/webhook.md) +* [firehydrant_change_event_entity](docs/resources/change_event_entity.md) +* [firehydrant_functionality_entity](docs/resources/functionality_entity.md) +* [firehydrant_incident_entity](docs/resources/incident_entity.md) +* [firehydrant_incident_role_entity](docs/resources/incident_role_entity.md) +* [firehydrant_incident_type_entity](docs/resources/incident_type_entity.md) +* [firehydrant_priority_entity](docs/resources/priority_entity.md) +* [firehydrant_runbook_entity](docs/resources/runbook_entity.md) +* [firehydrant_saved_search_entity](docs/resources/saved_search_entity.md) +* [firehydrant_scheduled_maintenance_entity](docs/resources/scheduled_maintenance_entity.md) +* [firehydrant_service_dependency_entity](docs/resources/service_dependency_entity.md) +* [firehydrant_service_entity](docs/resources/service_entity.md) +* [firehydrant_severity_entity](docs/resources/severity_entity.md) +* [firehydrant_signals_api_call_route_entity](docs/resources/signals_api_call_route_entity.md) +* [firehydrant_signals_api_email_target_entity](docs/resources/signals_api_email_target_entity.md) +* [firehydrant_signals_api_grouping_entity](docs/resources/signals_api_grouping_entity.md) +* [firehydrant_signals_api_rule_entity](docs/resources/signals_api_rule_entity.md) +* [firehydrant_signals_api_transposer_entity](docs/resources/signals_api_transposer_entity.md) +* [firehydrant_signals_api_webhook_target_entity](docs/resources/signals_api_webhook_target_entity.md) +* [firehydrant_team_entity](docs/resources/team_entity.md) +* [firehydrant_ticketing_priority_entity](docs/resources/ticketing_priority_entity.md) ### Data Sources -* [firehydrant_checklist_template](docs/data-sources/checklist_template.md) -* [firehydrant_checklist_templates](docs/data-sources/checklist_templates.md) -* [firehydrant_environment](docs/data-sources/environment.md) -* [firehydrant_environments](docs/data-sources/environments.md) -* [firehydrant_functionalities](docs/data-sources/functionalities.md) -* [firehydrant_functionality](docs/data-sources/functionality.md) -* [firehydrant_incident_role](docs/data-sources/incident_role.md) -* [firehydrant_incident_type](docs/data-sources/incident_type.md) -* [firehydrant_incident_types](docs/data-sources/incident_types.md) -* [firehydrant_priorities](docs/data-sources/priorities.md) -* [firehydrant_priority](docs/data-sources/priority.md) -* [firehydrant_runbook](docs/data-sources/runbook.md) -* [firehydrant_runbooks](docs/data-sources/runbooks.md) -* [firehydrant_service](docs/data-sources/service.md) -* [firehydrant_service_dependency](docs/data-sources/service_dependency.md) -* [firehydrant_services](docs/data-sources/services.md) -* [firehydrant_severities](docs/data-sources/severities.md) -* [firehydrant_severity](docs/data-sources/severity.md) -* [firehydrant_status_update_template](docs/data-sources/status_update_template.md) -* [firehydrant_status_update_templates](docs/data-sources/status_update_templates.md) -* [firehydrant_task_list](docs/data-sources/task_list.md) -* [firehydrant_task_lists](docs/data-sources/task_lists.md) -* [firehydrant_team](docs/data-sources/team.md) -* [firehydrant_teams](docs/data-sources/teams.md) -* [firehydrant_users](docs/data-sources/users.md) -* [firehydrant_webhook](docs/data-sources/webhook.md) -* [firehydrant_webhooks](docs/data-sources/webhooks.md) -* [firehydrant_webhook_target](docs/data-sources/webhook_target.md) +* [firehydrant_change_event_entity](docs/data-sources/change_event_entity.md) +* [firehydrant_change_events_entities](docs/data-sources/change_events_entities.md) +* [firehydrant_functionality_entity](docs/data-sources/functionality_entity.md) +* [firehydrant_incident_entity](docs/data-sources/incident_entity.md) +* [firehydrant_incident_role_entity](docs/data-sources/incident_role_entity.md) +* [firehydrant_incident_type_entity](docs/data-sources/incident_type_entity.md) +* [firehydrant_priorities_entities](docs/data-sources/priorities_entities.md) +* [firehydrant_priority_entity](docs/data-sources/priority_entity.md) +* [firehydrant_runbook_entity](docs/data-sources/runbook_entity.md) +* [firehydrant_runbooks_entities](docs/data-sources/runbooks_entities.md) +* [firehydrant_saved_search_entity](docs/data-sources/saved_search_entity.md) +* [firehydrant_saved_searches_entities](docs/data-sources/saved_searches_entities.md) +* [firehydrant_scheduled_maintenance_entity](docs/data-sources/scheduled_maintenance_entity.md) +* [firehydrant_scheduled_maintenances_entities](docs/data-sources/scheduled_maintenances_entities.md) +* [firehydrant_service_dependency_entity](docs/data-sources/service_dependency_entity.md) +* [firehydrant_service_entity](docs/data-sources/service_entity.md) +* [firehydrant_severity_entity](docs/data-sources/severity_entity.md) +* [firehydrant_signals_api_call_route_entity](docs/data-sources/signals_api_call_route_entity.md) +* [firehydrant_signals_api_email_target_entity](docs/data-sources/signals_api_email_target_entity.md) +* [firehydrant_signals_api_grouping_entity](docs/data-sources/signals_api_grouping_entity.md) +* [firehydrant_signals_api_rule_entity](docs/data-sources/signals_api_rule_entity.md) +* [firehydrant_signals_api_transposer_entity](docs/data-sources/signals_api_transposer_entity.md) +* [firehydrant_signals_api_webhook_target_entity](docs/data-sources/signals_api_webhook_target_entity.md) +* [firehydrant_team_entity](docs/data-sources/team_entity.md) +* [firehydrant_ticketing_priorities_entities](docs/data-sources/ticketing_priorities_entities.md) +* [firehydrant_ticketing_priority_entity](docs/data-sources/ticketing_priority_entity.md) diff --git a/internal/provider/checklisttemplate_data_source.go b/internal/provider/checklisttemplate_data_source.go deleted file mode 100644 index 1c4adde..0000000 --- a/internal/provider/checklisttemplate_data_source.go +++ /dev/null @@ -1,614 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &ChecklistTemplateDataSource{} -var _ datasource.DataSourceWithConfigure = &ChecklistTemplateDataSource{} - -func NewChecklistTemplateDataSource() datasource.DataSource { - return &ChecklistTemplateDataSource{} -} - -// ChecklistTemplateDataSource is the data source implementation. -type ChecklistTemplateDataSource struct { - client *sdk.Firehydrant -} - -// ChecklistTemplateDataSourceModel describes the data model. -type ChecklistTemplateDataSourceModel struct { - Checks []tfTypes.ChecklistCheckEntity `tfsdk:"checks"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Owner *tfTypes.TeamEntity `tfsdk:"owner"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *ChecklistTemplateDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_checklist_template" -} - -// Schema defines the schema for the data source. -func (r *ChecklistTemplateDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "ChecklistTemplate DataSource", - - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Required: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *ChecklistTemplateDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *ChecklistTemplateDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *ChecklistTemplateDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - request := operations.GetV1ChecklistTemplatesIDRequest{ - ID: id, - } - res, err := r.client.ChecklistTemplates.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ChecklistTemplateEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedChecklistTemplateEntity(res.ChecklistTemplateEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/checklisttemplate_data_source_sdk.go b/internal/provider/checklisttemplate_data_source_sdk.go deleted file mode 100644 index 1bfb2aa..0000000 --- a/internal/provider/checklisttemplate_data_source_sdk.go +++ /dev/null @@ -1,449 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *ChecklistTemplateDataSourceModel) RefreshFromSharedChecklistTemplateEntity(resp *shared.ChecklistTemplateEntity) { - if resp != nil { - r.Checks = []tfTypes.ChecklistCheckEntity{} - if len(r.Checks) > len(resp.Checks) { - r.Checks = r.Checks[:len(resp.Checks)] - } - for checksCount, checksItem := range resp.Checks { - var checks1 tfTypes.ChecklistCheckEntity - checks1.Description = types.StringPointerValue(checksItem.Description) - checks1.ID = types.StringPointerValue(checksItem.ID) - checks1.Name = types.StringPointerValue(checksItem.Name) - checks1.Status = types.BoolPointerValue(checksItem.Status) - if checksCount+1 > len(r.Checks) { - r.Checks = append(r.Checks, checks1) - } else { - r.Checks[checksCount].Description = checks1.Description - r.Checks[checksCount].ID = checks1.ID - r.Checks[checksCount].Name = checks1.Name - r.Checks[checksCount].Status = checks1.Status - } - } - r.CreatedAt = types.StringPointerValue(resp.CreatedAt) - r.Description = types.StringPointerValue(resp.Description) - r.ID = types.StringPointerValue(resp.ID) - r.Name = types.StringPointerValue(resp.Name) - if resp.Owner == nil { - r.Owner = nil - } else { - r.Owner = &tfTypes.TeamEntity{} - if resp.Owner.CreatedAt != nil { - r.Owner.CreatedAt = types.StringValue(resp.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.Owner.CreatedAt = types.StringNull() - } - if resp.Owner.CreatedBy == nil { - r.Owner.CreatedBy = nil - } else { - r.Owner.CreatedBy = &tfTypes.AuthorEntity{} - r.Owner.CreatedBy.Email = types.StringPointerValue(resp.Owner.CreatedBy.Email) - r.Owner.CreatedBy.ID = types.StringPointerValue(resp.Owner.CreatedBy.ID) - r.Owner.CreatedBy.Name = types.StringPointerValue(resp.Owner.CreatedBy.Name) - r.Owner.CreatedBy.Source = types.StringPointerValue(resp.Owner.CreatedBy.Source) - } - r.Owner.Description = types.StringPointerValue(resp.Owner.Description) - r.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Owner.Functionalities) > len(resp.Owner.Functionalities) { - r.Owner.Functionalities = r.Owner.Functionalities[:len(resp.Owner.Functionalities)] - } - for functionalitiesCount, functionalitiesItem := range resp.Owner.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(r.Owner.Functionalities) { - r.Owner.Functionalities = append(r.Owner.Functionalities, functionalities1) - } else { - r.Owner.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - r.Owner.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - r.Owner.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - r.Owner.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - r.Owner.Functionalities[functionalitiesCount].Description = functionalities1.Description - r.Owner.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - r.Owner.Functionalities[functionalitiesCount].ID = functionalities1.ID - r.Owner.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - r.Owner.Functionalities[functionalitiesCount].Links = functionalities1.Links - r.Owner.Functionalities[functionalitiesCount].Name = functionalities1.Name - r.Owner.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - r.Owner.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - r.Owner.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - r.Owner.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - r.Owner.ID = types.StringPointerValue(resp.Owner.ID) - r.Owner.Memberships = []tfTypes.MembershipEntity{} - if len(r.Owner.Memberships) > len(resp.Owner.Memberships) { - r.Owner.Memberships = r.Owner.Memberships[:len(resp.Owner.Memberships)] - } - for membershipsCount, membershipsItem := range resp.Owner.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(r.Owner.Memberships) { - r.Owner.Memberships = append(r.Owner.Memberships, memberships1) - } else { - r.Owner.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - r.Owner.Memberships[membershipsCount].Schedule = memberships1.Schedule - r.Owner.Memberships[membershipsCount].User = memberships1.User - } - } - if resp.Owner.MsTeamsChannel == nil { - r.Owner.MsTeamsChannel = nil - } else { - r.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelID) - r.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelName) - r.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelURL) - r.Owner.MsTeamsChannel.ID = types.StringPointerValue(resp.Owner.MsTeamsChannel.ID) - r.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.Owner.MsTeamsChannel.MsTeamID) - r.Owner.MsTeamsChannel.Status = types.StringPointerValue(resp.Owner.MsTeamsChannel.Status) - r.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(resp.Owner.MsTeamsChannel.TeamName) - } - r.Owner.Name = types.StringPointerValue(resp.Owner.Name) - r.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.Owner.OwnedFunctionalities) > len(resp.Owner.OwnedFunctionalities) { - r.Owner.OwnedFunctionalities = r.Owner.OwnedFunctionalities[:len(resp.Owner.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range resp.Owner.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(r.Owner.OwnedFunctionalities) { - r.Owner.OwnedFunctionalities = append(r.Owner.OwnedFunctionalities, ownedFunctionalities1) - } else { - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - r.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.Owner.OwnedRunbooks) > len(resp.Owner.OwnedRunbooks) { - r.Owner.OwnedRunbooks = r.Owner.OwnedRunbooks[:len(resp.Owner.OwnedRunbooks)] - } - for ownedRunbooksCount, ownedRunbooksItem := range resp.Owner.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(r.Owner.OwnedRunbooks) { - r.Owner.OwnedRunbooks = append(r.Owner.OwnedRunbooks, ownedRunbooks1) - } else { - r.Owner.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - r.Owner.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - r.Owner.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - r.Owner.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - r.Owner.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - r.Owner.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - r.Owner.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - r.Owner.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - r.Owner.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - r.Owner.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - r.Owner.SignalsIcalURL = types.StringPointerValue(resp.Owner.SignalsIcalURL) - if resp.Owner.SlackChannel == nil { - r.Owner.SlackChannel = nil - } else { - r.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.Owner.SlackChannel.ID = types.StringPointerValue(resp.Owner.SlackChannel.ID) - r.Owner.SlackChannel.Name = types.StringPointerValue(resp.Owner.SlackChannel.Name) - r.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(resp.Owner.SlackChannel.SlackChannelID) - } - r.Owner.Slug = types.StringPointerValue(resp.Owner.Slug) - if resp.Owner.UpdatedAt != nil { - r.Owner.UpdatedAt = types.StringValue(resp.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Owner.UpdatedAt = types.StringNull() - } - } - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} diff --git a/internal/provider/checklisttemplate_resource.go b/internal/provider/checklisttemplate_resource.go deleted file mode 100644 index f23dc2c..0000000 --- a/internal/provider/checklisttemplate_resource.go +++ /dev/null @@ -1,886 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - speakeasy_objectvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/objectvalidators" - speakeasy_stringvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/stringvalidators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &ChecklistTemplateResource{} -var _ resource.ResourceWithImportState = &ChecklistTemplateResource{} - -func NewChecklistTemplateResource() resource.Resource { - return &ChecklistTemplateResource{} -} - -// ChecklistTemplateResource defines the resource implementation. -type ChecklistTemplateResource struct { - client *sdk.Firehydrant -} - -// ChecklistTemplateResourceModel describes the resource data model. -type ChecklistTemplateResourceModel struct { - Checks []tfTypes.Checks `tfsdk:"checks"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Owner *tfTypes.TeamEntity `tfsdk:"owner"` - TeamID types.String `tfsdk:"team_id"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *ChecklistTemplateResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_checklist_template" -} - -func (r *ChecklistTemplateResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "ChecklistTemplate Resource", - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Required: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `The description of the check`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `The name of the check. Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - Description: `An array of checks for the checklist template`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "id": schema.StringAttribute{ - Computed: true, - Description: `Checklist Template UUID`, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `TeamEntity model`, - }, - "team_id": schema.StringAttribute{ - Optional: true, - Description: `The ID of the Team that owns the checklist template`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *ChecklistTemplateResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *ChecklistTemplateResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *ChecklistTemplateResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1ChecklistTemplates() - res, err := r.client.ChecklistTemplates.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ChecklistTemplateEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedChecklistTemplateEntity(res.ChecklistTemplateEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var id string - id = data.ID.ValueString() - - request1 := operations.GetV1ChecklistTemplatesIDRequest{ - ID: id, - } - res1, err := r.client.ChecklistTemplates.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.ChecklistTemplateEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedChecklistTemplateEntity(res1.ChecklistTemplateEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ChecklistTemplateResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *ChecklistTemplateResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - request := operations.GetV1ChecklistTemplatesIDRequest{ - ID: id, - } - res, err := r.client.ChecklistTemplates.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ChecklistTemplateEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedChecklistTemplateEntity(res.ChecklistTemplateEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ChecklistTemplateResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *ChecklistTemplateResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - patchV1ChecklistTemplatesID := *data.ToSharedPatchV1ChecklistTemplatesID() - request := operations.PatchV1ChecklistTemplatesIDRequest{ - ID: id, - PatchV1ChecklistTemplatesID: patchV1ChecklistTemplatesID, - } - res, err := r.client.ChecklistTemplates.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ChecklistTemplateEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedChecklistTemplateEntity(res.ChecklistTemplateEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var id1 string - id1 = data.ID.ValueString() - - request1 := operations.GetV1ChecklistTemplatesIDRequest{ - ID: id1, - } - res1, err := r.client.ChecklistTemplates.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.ChecklistTemplateEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedChecklistTemplateEntity(res1.ChecklistTemplateEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ChecklistTemplateResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *ChecklistTemplateResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - request := operations.DeleteV1ChecklistTemplatesIDRequest{ - ID: id, - } - res, err := r.client.ChecklistTemplates.Archive(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *ChecklistTemplateResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/checklisttemplate_resource_sdk.go b/internal/provider/checklisttemplate_resource_sdk.go deleted file mode 100644 index 88bce96..0000000 --- a/internal/provider/checklisttemplate_resource_sdk.go +++ /dev/null @@ -1,541 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *ChecklistTemplateResourceModel) ToSharedPostV1ChecklistTemplates() *shared.PostV1ChecklistTemplates { - var name string - name = r.Name.ValueString() - - var checks []shared.Checks = []shared.Checks{} - for _, checksItem := range r.Checks { - var name1 string - name1 = checksItem.Name.ValueString() - - description := new(string) - if !checksItem.Description.IsUnknown() && !checksItem.Description.IsNull() { - *description = checksItem.Description.ValueString() - } else { - description = nil - } - checks = append(checks, shared.Checks{ - Name: name1, - Description: description, - }) - } - description1 := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description1 = r.Description.ValueString() - } else { - description1 = nil - } - teamID := new(string) - if !r.TeamID.IsUnknown() && !r.TeamID.IsNull() { - *teamID = r.TeamID.ValueString() - } else { - teamID = nil - } - out := shared.PostV1ChecklistTemplates{ - Name: name, - Checks: checks, - Description: description1, - TeamID: teamID, - } - return &out -} - -func (r *ChecklistTemplateResourceModel) RefreshFromSharedChecklistTemplateEntity(resp *shared.ChecklistTemplateEntity) { - if resp != nil { - r.Checks = []tfTypes.Checks{} - if len(r.Checks) > len(resp.Checks) { - r.Checks = r.Checks[:len(resp.Checks)] - } - for checksCount, checksItem := range resp.Checks { - var checks1 tfTypes.Checks - checks1.Description = types.StringPointerValue(checksItem.Description) - checks1.ID = types.StringPointerValue(checksItem.ID) - checks1.Name = types.StringPointerValue(checksItem.Name) - checks1.Status = types.BoolPointerValue(checksItem.Status) - if checksCount+1 > len(r.Checks) { - r.Checks = append(r.Checks, checks1) - } else { - r.Checks[checksCount].Description = checks1.Description - r.Checks[checksCount].ID = checks1.ID - r.Checks[checksCount].Name = checks1.Name - r.Checks[checksCount].Status = checks1.Status - } - } - r.CreatedAt = types.StringPointerValue(resp.CreatedAt) - r.Description = types.StringPointerValue(resp.Description) - r.ID = types.StringPointerValue(resp.ID) - r.Name = types.StringPointerValue(resp.Name) - if resp.Owner == nil { - r.Owner = nil - } else { - r.Owner = &tfTypes.TeamEntity{} - if resp.Owner.CreatedAt != nil { - r.Owner.CreatedAt = types.StringValue(resp.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.Owner.CreatedAt = types.StringNull() - } - if resp.Owner.CreatedBy == nil { - r.Owner.CreatedBy = nil - } else { - r.Owner.CreatedBy = &tfTypes.AuthorEntity{} - r.Owner.CreatedBy.Email = types.StringPointerValue(resp.Owner.CreatedBy.Email) - r.Owner.CreatedBy.ID = types.StringPointerValue(resp.Owner.CreatedBy.ID) - r.Owner.CreatedBy.Name = types.StringPointerValue(resp.Owner.CreatedBy.Name) - r.Owner.CreatedBy.Source = types.StringPointerValue(resp.Owner.CreatedBy.Source) - } - r.Owner.Description = types.StringPointerValue(resp.Owner.Description) - r.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Owner.Functionalities) > len(resp.Owner.Functionalities) { - r.Owner.Functionalities = r.Owner.Functionalities[:len(resp.Owner.Functionalities)] - } - for functionalitiesCount, functionalitiesItem := range resp.Owner.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(r.Owner.Functionalities) { - r.Owner.Functionalities = append(r.Owner.Functionalities, functionalities1) - } else { - r.Owner.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - r.Owner.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - r.Owner.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - r.Owner.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - r.Owner.Functionalities[functionalitiesCount].Description = functionalities1.Description - r.Owner.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - r.Owner.Functionalities[functionalitiesCount].ID = functionalities1.ID - r.Owner.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - r.Owner.Functionalities[functionalitiesCount].Links = functionalities1.Links - r.Owner.Functionalities[functionalitiesCount].Name = functionalities1.Name - r.Owner.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - r.Owner.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - r.Owner.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - r.Owner.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - r.Owner.ID = types.StringPointerValue(resp.Owner.ID) - r.Owner.Memberships = []tfTypes.MembershipEntity{} - if len(r.Owner.Memberships) > len(resp.Owner.Memberships) { - r.Owner.Memberships = r.Owner.Memberships[:len(resp.Owner.Memberships)] - } - for membershipsCount, membershipsItem := range resp.Owner.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(r.Owner.Memberships) { - r.Owner.Memberships = append(r.Owner.Memberships, memberships1) - } else { - r.Owner.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - r.Owner.Memberships[membershipsCount].Schedule = memberships1.Schedule - r.Owner.Memberships[membershipsCount].User = memberships1.User - } - } - if resp.Owner.MsTeamsChannel == nil { - r.Owner.MsTeamsChannel = nil - } else { - r.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelID) - r.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelName) - r.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelURL) - r.Owner.MsTeamsChannel.ID = types.StringPointerValue(resp.Owner.MsTeamsChannel.ID) - r.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.Owner.MsTeamsChannel.MsTeamID) - r.Owner.MsTeamsChannel.Status = types.StringPointerValue(resp.Owner.MsTeamsChannel.Status) - r.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(resp.Owner.MsTeamsChannel.TeamName) - } - r.Owner.Name = types.StringPointerValue(resp.Owner.Name) - r.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.Owner.OwnedFunctionalities) > len(resp.Owner.OwnedFunctionalities) { - r.Owner.OwnedFunctionalities = r.Owner.OwnedFunctionalities[:len(resp.Owner.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range resp.Owner.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(r.Owner.OwnedFunctionalities) { - r.Owner.OwnedFunctionalities = append(r.Owner.OwnedFunctionalities, ownedFunctionalities1) - } else { - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - r.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.Owner.OwnedRunbooks) > len(resp.Owner.OwnedRunbooks) { - r.Owner.OwnedRunbooks = r.Owner.OwnedRunbooks[:len(resp.Owner.OwnedRunbooks)] - } - for ownedRunbooksCount, ownedRunbooksItem := range resp.Owner.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(r.Owner.OwnedRunbooks) { - r.Owner.OwnedRunbooks = append(r.Owner.OwnedRunbooks, ownedRunbooks1) - } else { - r.Owner.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - r.Owner.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - r.Owner.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - r.Owner.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - r.Owner.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - r.Owner.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - r.Owner.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - r.Owner.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - r.Owner.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - r.Owner.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - r.Owner.SignalsIcalURL = types.StringPointerValue(resp.Owner.SignalsIcalURL) - if resp.Owner.SlackChannel == nil { - r.Owner.SlackChannel = nil - } else { - r.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.Owner.SlackChannel.ID = types.StringPointerValue(resp.Owner.SlackChannel.ID) - r.Owner.SlackChannel.Name = types.StringPointerValue(resp.Owner.SlackChannel.Name) - r.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(resp.Owner.SlackChannel.SlackChannelID) - } - r.Owner.Slug = types.StringPointerValue(resp.Owner.Slug) - if resp.Owner.UpdatedAt != nil { - r.Owner.UpdatedAt = types.StringValue(resp.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Owner.UpdatedAt = types.StringNull() - } - } - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} - -func (r *ChecklistTemplateResourceModel) ToSharedPatchV1ChecklistTemplatesID() *shared.PatchV1ChecklistTemplatesID { - name := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name = r.Name.ValueString() - } else { - name = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - var checks []shared.PatchV1ChecklistTemplatesIDChecks = []shared.PatchV1ChecklistTemplatesIDChecks{} - for _, checksItem := range r.Checks { - id := new(string) - if !checksItem.ID.IsUnknown() && !checksItem.ID.IsNull() { - *id = checksItem.ID.ValueString() - } else { - id = nil - } - description1 := new(string) - if !checksItem.Description.IsUnknown() && !checksItem.Description.IsNull() { - *description1 = checksItem.Description.ValueString() - } else { - description1 = nil - } - var name1 string - name1 = checksItem.Name.ValueString() - - checks = append(checks, shared.PatchV1ChecklistTemplatesIDChecks{ - ID: id, - Description: description1, - Name: name1, - }) - } - teamID := new(string) - if !r.TeamID.IsUnknown() && !r.TeamID.IsNull() { - *teamID = r.TeamID.ValueString() - } else { - teamID = nil - } - out := shared.PatchV1ChecklistTemplatesID{ - Name: name, - Description: description, - Checks: checks, - TeamID: teamID, - } - return &out -} diff --git a/internal/provider/checklisttemplates_data_source.go b/internal/provider/checklisttemplates_data_source.go deleted file mode 100644 index bd8d261..0000000 --- a/internal/provider/checklisttemplates_data_source.go +++ /dev/null @@ -1,672 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &ChecklistTemplatesDataSource{} -var _ datasource.DataSourceWithConfigure = &ChecklistTemplatesDataSource{} - -func NewChecklistTemplatesDataSource() datasource.DataSource { - return &ChecklistTemplatesDataSource{} -} - -// ChecklistTemplatesDataSource is the data source implementation. -type ChecklistTemplatesDataSource struct { - client *sdk.Firehydrant -} - -// ChecklistTemplatesDataSourceModel describes the data model. -type ChecklistTemplatesDataSourceModel struct { - Data []tfTypes.Checklists `tfsdk:"data"` - Page types.Int64 `tfsdk:"page"` - Pagination *tfTypes.PaginationEntity `tfsdk:"pagination"` - PerPage types.Int64 `tfsdk:"per_page"` - Query types.String `tfsdk:"query"` -} - -// Metadata returns the data source type name. -func (r *ChecklistTemplatesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_checklist_templates" -} - -// Schema defines the schema for the data source. -func (r *ChecklistTemplatesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "ChecklistTemplates DataSource", - - Attributes: map[string]schema.Attribute{ - "data": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "pagination": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "count": schema.Int64Attribute{ - Computed: true, - }, - "items": schema.Int64Attribute{ - Computed: true, - }, - "last": schema.Int64Attribute{ - Computed: true, - }, - "next": schema.Int64Attribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Computed: true, - }, - "pages": schema.Int64Attribute{ - Computed: true, - }, - "prev": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "query": schema.StringAttribute{ - Optional: true, - Description: `A query to search checklist templates by their name`, - }, - }, - } -} - -func (r *ChecklistTemplatesDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *ChecklistTemplatesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *ChecklistTemplatesDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - query := new(string) - if !data.Query.IsUnknown() && !data.Query.IsNull() { - *query = data.Query.ValueString() - } else { - query = nil - } - request := operations.GetV1ChecklistTemplatesRequest{ - Page: page, - PerPage: perPage, - Query: query, - } - res, err := r.client.ChecklistTemplates.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ChecklistTemplateEntityPaginated != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedChecklistTemplateEntityPaginated(res.ChecklistTemplateEntityPaginated) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/checklisttemplates_data_source_sdk.go b/internal/provider/checklisttemplates_data_source_sdk.go deleted file mode 100644 index 49cb6fd..0000000 --- a/internal/provider/checklisttemplates_data_source_sdk.go +++ /dev/null @@ -1,492 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *ChecklistTemplatesDataSourceModel) RefreshFromSharedChecklistTemplateEntityPaginated(resp *shared.ChecklistTemplateEntityPaginated) { - if resp != nil { - r.Data = []tfTypes.Checklists{} - if len(r.Data) > len(resp.Data) { - r.Data = r.Data[:len(resp.Data)] - } - for dataCount, dataItem := range resp.Data { - var data1 tfTypes.Checklists - data1.Checks = []tfTypes.ChecklistCheckEntity{} - for checksCount, checksItem := range dataItem.Checks { - var checks1 tfTypes.ChecklistCheckEntity - checks1.Description = types.StringPointerValue(checksItem.Description) - checks1.ID = types.StringPointerValue(checksItem.ID) - checks1.Name = types.StringPointerValue(checksItem.Name) - checks1.Status = types.BoolPointerValue(checksItem.Status) - if checksCount+1 > len(data1.Checks) { - data1.Checks = append(data1.Checks, checks1) - } else { - data1.Checks[checksCount].Description = checks1.Description - data1.Checks[checksCount].ID = checks1.ID - data1.Checks[checksCount].Name = checks1.Name - data1.Checks[checksCount].Status = checks1.Status - } - } - data1.CreatedAt = types.StringPointerValue(dataItem.CreatedAt) - data1.Description = types.StringPointerValue(dataItem.Description) - data1.ID = types.StringPointerValue(dataItem.ID) - data1.Name = types.StringPointerValue(dataItem.Name) - if dataItem.Owner == nil { - data1.Owner = nil - } else { - data1.Owner = &tfTypes.TeamEntity{} - if dataItem.Owner.CreatedAt != nil { - data1.Owner.CreatedAt = types.StringValue(dataItem.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.Owner.CreatedAt = types.StringNull() - } - if dataItem.Owner.CreatedBy == nil { - data1.Owner.CreatedBy = nil - } else { - data1.Owner.CreatedBy = &tfTypes.AuthorEntity{} - data1.Owner.CreatedBy.Email = types.StringPointerValue(dataItem.Owner.CreatedBy.Email) - data1.Owner.CreatedBy.ID = types.StringPointerValue(dataItem.Owner.CreatedBy.ID) - data1.Owner.CreatedBy.Name = types.StringPointerValue(dataItem.Owner.CreatedBy.Name) - data1.Owner.CreatedBy.Source = types.StringPointerValue(dataItem.Owner.CreatedBy.Source) - } - data1.Owner.Description = types.StringPointerValue(dataItem.Owner.Description) - data1.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount, functionalitiesItem := range dataItem.Owner.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(data1.Owner.Functionalities) { - data1.Owner.Functionalities = append(data1.Owner.Functionalities, functionalities1) - } else { - data1.Owner.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - data1.Owner.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - data1.Owner.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - data1.Owner.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - data1.Owner.Functionalities[functionalitiesCount].Description = functionalities1.Description - data1.Owner.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - data1.Owner.Functionalities[functionalitiesCount].ID = functionalities1.ID - data1.Owner.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - data1.Owner.Functionalities[functionalitiesCount].Links = functionalities1.Links - data1.Owner.Functionalities[functionalitiesCount].Name = functionalities1.Name - data1.Owner.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - data1.Owner.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - data1.Owner.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - data1.Owner.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - data1.Owner.ID = types.StringPointerValue(dataItem.Owner.ID) - data1.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range dataItem.Owner.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(data1.Owner.Memberships) { - data1.Owner.Memberships = append(data1.Owner.Memberships, memberships1) - } else { - data1.Owner.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - data1.Owner.Memberships[membershipsCount].Schedule = memberships1.Schedule - data1.Owner.Memberships[membershipsCount].User = memberships1.User - } - } - if dataItem.Owner.MsTeamsChannel == nil { - data1.Owner.MsTeamsChannel = nil - } else { - data1.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - data1.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.ChannelID) - data1.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.ChannelName) - data1.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.ChannelURL) - data1.Owner.MsTeamsChannel.ID = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.ID) - data1.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.MsTeamID) - data1.Owner.MsTeamsChannel.Status = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.Status) - data1.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.TeamName) - } - data1.Owner.Name = types.StringPointerValue(dataItem.Owner.Name) - data1.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range dataItem.Owner.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(data1.Owner.OwnedFunctionalities) { - data1.Owner.OwnedFunctionalities = append(data1.Owner.OwnedFunctionalities, ownedFunctionalities1) - } else { - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - data1.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range dataItem.Owner.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(data1.Owner.OwnedRunbooks) { - data1.Owner.OwnedRunbooks = append(data1.Owner.OwnedRunbooks, ownedRunbooks1) - } else { - data1.Owner.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - data1.Owner.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - data1.Owner.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - data1.Owner.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - data1.Owner.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - data1.Owner.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - data1.Owner.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - data1.Owner.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - data1.Owner.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - data1.Owner.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - data1.Owner.SignalsIcalURL = types.StringPointerValue(dataItem.Owner.SignalsIcalURL) - if dataItem.Owner.SlackChannel == nil { - data1.Owner.SlackChannel = nil - } else { - data1.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - data1.Owner.SlackChannel.ID = types.StringPointerValue(dataItem.Owner.SlackChannel.ID) - data1.Owner.SlackChannel.Name = types.StringPointerValue(dataItem.Owner.SlackChannel.Name) - data1.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(dataItem.Owner.SlackChannel.SlackChannelID) - } - data1.Owner.Slug = types.StringPointerValue(dataItem.Owner.Slug) - if dataItem.Owner.UpdatedAt != nil { - data1.Owner.UpdatedAt = types.StringValue(dataItem.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.Owner.UpdatedAt = types.StringNull() - } - } - if dataItem.UpdatedAt != nil { - data1.UpdatedAt = types.StringValue(dataItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.UpdatedAt = types.StringNull() - } - if dataCount+1 > len(r.Data) { - r.Data = append(r.Data, data1) - } else { - r.Data[dataCount].Checks = data1.Checks - r.Data[dataCount].CreatedAt = data1.CreatedAt - r.Data[dataCount].Description = data1.Description - r.Data[dataCount].ID = data1.ID - r.Data[dataCount].Name = data1.Name - r.Data[dataCount].Owner = data1.Owner - r.Data[dataCount].UpdatedAt = data1.UpdatedAt - } - } - if resp.Pagination == nil { - r.Pagination = nil - } else { - r.Pagination = &tfTypes.PaginationEntity{} - if resp.Pagination.Count != nil { - r.Pagination.Count = types.Int64Value(int64(*resp.Pagination.Count)) - } else { - r.Pagination.Count = types.Int64Null() - } - if resp.Pagination.Items != nil { - r.Pagination.Items = types.Int64Value(int64(*resp.Pagination.Items)) - } else { - r.Pagination.Items = types.Int64Null() - } - if resp.Pagination.Last != nil { - r.Pagination.Last = types.Int64Value(int64(*resp.Pagination.Last)) - } else { - r.Pagination.Last = types.Int64Null() - } - if resp.Pagination.Next != nil { - r.Pagination.Next = types.Int64Value(int64(*resp.Pagination.Next)) - } else { - r.Pagination.Next = types.Int64Null() - } - if resp.Pagination.Page != nil { - r.Pagination.Page = types.Int64Value(int64(*resp.Pagination.Page)) - } else { - r.Pagination.Page = types.Int64Null() - } - if resp.Pagination.Pages != nil { - r.Pagination.Pages = types.Int64Value(int64(*resp.Pagination.Pages)) - } else { - r.Pagination.Pages = types.Int64Null() - } - if resp.Pagination.Prev != nil { - r.Pagination.Prev = types.Int64Value(int64(*resp.Pagination.Prev)) - } else { - r.Pagination.Prev = types.Int64Null() - } - } - } -} diff --git a/internal/provider/environment_data_source.go b/internal/provider/environment_data_source.go deleted file mode 100644 index c801625..0000000 --- a/internal/provider/environment_data_source.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &EnvironmentDataSource{} -var _ datasource.DataSourceWithConfigure = &EnvironmentDataSource{} - -func NewEnvironmentDataSource() datasource.DataSource { - return &EnvironmentDataSource{} -} - -// EnvironmentDataSource is the data source implementation. -type EnvironmentDataSource struct { - client *sdk.Firehydrant -} - -// EnvironmentDataSourceModel describes the data model. -type EnvironmentDataSourceModel struct { - ActiveIncidents types.String `tfsdk:"active_incidents"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []tfTypes.ExternalResourceEntity `tfsdk:"external_resources"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *EnvironmentDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_environment" -} - -// Schema defines the schema for the data source. -func (r *EnvironmentDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Environment DataSource", - - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.StringAttribute{ - Computed: true, - Description: `List of active incident guids`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Description: `The time the environment was created`, - }, - "description": schema.StringAttribute{ - Computed: true, - Description: `Description of the Environment`, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - Description: `UUID of the Environment`, - }, - "name": schema.StringAttribute{ - Computed: true, - Description: `Name of the Environment`, - }, - "slug": schema.StringAttribute{ - Computed: true, - Description: `Slug of the Environment`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Description: `The time the environment was updated`, - }, - }, - } -} - -func (r *EnvironmentDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *EnvironmentDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *EnvironmentDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var environmentID string - environmentID = data.ID.ValueString() - - request := operations.GetV1EnvironmentsEnvironmentIDRequest{ - EnvironmentID: environmentID, - } - res, err := r.client.Environments.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.EnvironmentEntryEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedEnvironmentEntryEntity(res.EnvironmentEntryEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/environment_data_source_sdk.go b/internal/provider/environment_data_source_sdk.go deleted file mode 100644 index d9b5436..0000000 --- a/internal/provider/environment_data_source_sdk.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *EnvironmentDataSourceModel) RefreshFromSharedEnvironmentEntryEntity(resp *shared.EnvironmentEntryEntity) { - if resp != nil { - r.ActiveIncidents = types.StringPointerValue(resp.ActiveIncidents) - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.Description = types.StringPointerValue(resp.Description) - r.ExternalResources = []tfTypes.ExternalResourceEntity{} - if len(r.ExternalResources) > len(resp.ExternalResources) { - r.ExternalResources = r.ExternalResources[:len(resp.ExternalResources)] - } - for externalResourcesCount, externalResourcesItem := range resp.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(r.ExternalResources) { - r.ExternalResources = append(r.ExternalResources, externalResources1) - } else { - r.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - r.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - r.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - r.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - r.ExternalResources[externalResourcesCount].Name = externalResources1.Name - r.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - r.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - r.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - r.ID = types.StringPointerValue(resp.ID) - r.Name = types.StringPointerValue(resp.Name) - r.Slug = types.StringPointerValue(resp.Slug) - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} diff --git a/internal/provider/environment_resource.go b/internal/provider/environment_resource.go deleted file mode 100644 index ad9bb5a..0000000 --- a/internal/provider/environment_resource.go +++ /dev/null @@ -1,342 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &EnvironmentResource{} -var _ resource.ResourceWithImportState = &EnvironmentResource{} - -func NewEnvironmentResource() resource.Resource { - return &EnvironmentResource{} -} - -// EnvironmentResource defines the resource implementation. -type EnvironmentResource struct { - client *sdk.Firehydrant -} - -// EnvironmentResourceModel describes the resource data model. -type EnvironmentResourceModel struct { - ActiveIncidents types.String `tfsdk:"active_incidents"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []tfTypes.ExternalResourceEntity `tfsdk:"external_resources"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *EnvironmentResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_environment" -} - -func (r *EnvironmentResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Environment Resource", - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.StringAttribute{ - Computed: true, - Description: `List of active incident guids`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Description: `The time the environment was created`, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - Description: `UUID of the Environment`, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - Description: `Slug of the Environment`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Description: `The time the environment was updated`, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *EnvironmentResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *EnvironmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *EnvironmentResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1Environments() - res, err := r.client.Environments.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.EnvironmentEntryEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedEnvironmentEntryEntity(res.EnvironmentEntryEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *EnvironmentResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *EnvironmentResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var environmentID string - environmentID = data.ID.ValueString() - - request := operations.GetV1EnvironmentsEnvironmentIDRequest{ - EnvironmentID: environmentID, - } - res, err := r.client.Environments.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.EnvironmentEntryEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedEnvironmentEntryEntity(res.EnvironmentEntryEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *EnvironmentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *EnvironmentResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var environmentID string - environmentID = data.ID.ValueString() - - patchV1EnvironmentsEnvironmentID := *data.ToSharedPatchV1EnvironmentsEnvironmentID() - request := operations.PatchV1EnvironmentsEnvironmentIDRequest{ - EnvironmentID: environmentID, - PatchV1EnvironmentsEnvironmentID: patchV1EnvironmentsEnvironmentID, - } - res, err := r.client.Environments.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.EnvironmentEntryEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedEnvironmentEntryEntity(res.EnvironmentEntryEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *EnvironmentResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *EnvironmentResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var environmentID string - environmentID = data.ID.ValueString() - - request := operations.DeleteV1EnvironmentsEnvironmentIDRequest{ - EnvironmentID: environmentID, - } - res, err := r.client.Environments.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *EnvironmentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/environment_resource_sdk.go b/internal/provider/environment_resource_sdk.go deleted file mode 100644 index 62c1220..0000000 --- a/internal/provider/environment_resource_sdk.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *EnvironmentResourceModel) ToSharedPostV1Environments() *shared.PostV1Environments { - var name string - name = r.Name.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - out := shared.PostV1Environments{ - Name: name, - Description: description, - } - return &out -} - -func (r *EnvironmentResourceModel) RefreshFromSharedEnvironmentEntryEntity(resp *shared.EnvironmentEntryEntity) { - if resp != nil { - r.ActiveIncidents = types.StringPointerValue(resp.ActiveIncidents) - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.Description = types.StringPointerValue(resp.Description) - r.ExternalResources = []tfTypes.ExternalResourceEntity{} - if len(r.ExternalResources) > len(resp.ExternalResources) { - r.ExternalResources = r.ExternalResources[:len(resp.ExternalResources)] - } - for externalResourcesCount, externalResourcesItem := range resp.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(r.ExternalResources) { - r.ExternalResources = append(r.ExternalResources, externalResources1) - } else { - r.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - r.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - r.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - r.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - r.ExternalResources[externalResourcesCount].Name = externalResources1.Name - r.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - r.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - r.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - r.ID = types.StringPointerValue(resp.ID) - r.Name = types.StringPointerValue(resp.Name) - r.Slug = types.StringPointerValue(resp.Slug) - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} - -func (r *EnvironmentResourceModel) ToSharedPatchV1EnvironmentsEnvironmentID() *shared.PatchV1EnvironmentsEnvironmentID { - var name string - name = r.Name.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - out := shared.PatchV1EnvironmentsEnvironmentID{ - Name: name, - Description: description, - } - return &out -} diff --git a/internal/provider/environments_data_source.go b/internal/provider/environments_data_source.go deleted file mode 100644 index 5c86747..0000000 --- a/internal/provider/environments_data_source.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &EnvironmentsDataSource{} -var _ datasource.DataSourceWithConfigure = &EnvironmentsDataSource{} - -func NewEnvironmentsDataSource() datasource.DataSource { - return &EnvironmentsDataSource{} -} - -// EnvironmentsDataSource is the data source implementation. -type EnvironmentsDataSource struct { - client *sdk.Firehydrant -} - -// EnvironmentsDataSourceModel describes the data model. -type EnvironmentsDataSourceModel struct { - Data []tfTypes.EnvironmentEntryEntity `tfsdk:"data"` - Name types.String `tfsdk:"name"` - Page types.Int64 `tfsdk:"page"` - Pagination *tfTypes.PaginationEntity `tfsdk:"pagination"` - PerPage types.Int64 `tfsdk:"per_page"` - Query types.String `tfsdk:"query"` -} - -// Metadata returns the data source type name. -func (r *EnvironmentsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_environments" -} - -// Schema defines the schema for the data source. -func (r *EnvironmentsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Environments DataSource", - - Attributes: map[string]schema.Attribute{ - "data": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.StringAttribute{ - Computed: true, - Description: `List of active incident guids`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Description: `The time the environment was created`, - }, - "description": schema.StringAttribute{ - Computed: true, - Description: `Description of the Environment`, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - Description: `UUID of the Environment`, - }, - "name": schema.StringAttribute{ - Computed: true, - Description: `Name of the Environment`, - }, - "slug": schema.StringAttribute{ - Computed: true, - Description: `Slug of the Environment`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Description: `The time the environment was updated`, - }, - }, - }, - }, - "name": schema.StringAttribute{ - Optional: true, - Description: `A query to search environments by their name`, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "pagination": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "count": schema.Int64Attribute{ - Computed: true, - }, - "items": schema.Int64Attribute{ - Computed: true, - }, - "last": schema.Int64Attribute{ - Computed: true, - }, - "next": schema.Int64Attribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Computed: true, - }, - "pages": schema.Int64Attribute{ - Computed: true, - }, - "prev": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "query": schema.StringAttribute{ - Optional: true, - Description: `A query to search environments by their name or description`, - }, - }, - } -} - -func (r *EnvironmentsDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *EnvironmentsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *EnvironmentsDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - query := new(string) - if !data.Query.IsUnknown() && !data.Query.IsNull() { - *query = data.Query.ValueString() - } else { - query = nil - } - name := new(string) - if !data.Name.IsUnknown() && !data.Name.IsNull() { - *name = data.Name.ValueString() - } else { - name = nil - } - request := operations.GetV1EnvironmentsRequest{ - Page: page, - PerPage: perPage, - Query: query, - Name: name, - } - res, err := r.client.Environments.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.EnvironmentEntryEntityPaginated != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedEnvironmentEntryEntityPaginated(res.EnvironmentEntryEntityPaginated) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/environments_data_source_sdk.go b/internal/provider/environments_data_source_sdk.go deleted file mode 100644 index b6675aa..0000000 --- a/internal/provider/environments_data_source_sdk.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *EnvironmentsDataSourceModel) RefreshFromSharedEnvironmentEntryEntityPaginated(resp *shared.EnvironmentEntryEntityPaginated) { - if resp != nil { - r.Data = []tfTypes.EnvironmentEntryEntity{} - if len(r.Data) > len(resp.Data) { - r.Data = r.Data[:len(resp.Data)] - } - for dataCount, dataItem := range resp.Data { - var data1 tfTypes.EnvironmentEntryEntity - data1.ActiveIncidents = types.StringPointerValue(dataItem.ActiveIncidents) - if dataItem.CreatedAt != nil { - data1.CreatedAt = types.StringValue(dataItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.CreatedAt = types.StringNull() - } - data1.Description = types.StringPointerValue(dataItem.Description) - data1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range dataItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(data1.ExternalResources) { - data1.ExternalResources = append(data1.ExternalResources, externalResources1) - } else { - data1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - data1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - data1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - data1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - data1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - data1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - data1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - data1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - data1.ID = types.StringPointerValue(dataItem.ID) - data1.Name = types.StringPointerValue(dataItem.Name) - data1.Slug = types.StringPointerValue(dataItem.Slug) - if dataItem.UpdatedAt != nil { - data1.UpdatedAt = types.StringValue(dataItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.UpdatedAt = types.StringNull() - } - if dataCount+1 > len(r.Data) { - r.Data = append(r.Data, data1) - } else { - r.Data[dataCount].ActiveIncidents = data1.ActiveIncidents - r.Data[dataCount].CreatedAt = data1.CreatedAt - r.Data[dataCount].Description = data1.Description - r.Data[dataCount].ExternalResources = data1.ExternalResources - r.Data[dataCount].ID = data1.ID - r.Data[dataCount].Name = data1.Name - r.Data[dataCount].Slug = data1.Slug - r.Data[dataCount].UpdatedAt = data1.UpdatedAt - } - } - if resp.Pagination == nil { - r.Pagination = nil - } else { - r.Pagination = &tfTypes.PaginationEntity{} - if resp.Pagination.Count != nil { - r.Pagination.Count = types.Int64Value(int64(*resp.Pagination.Count)) - } else { - r.Pagination.Count = types.Int64Null() - } - if resp.Pagination.Items != nil { - r.Pagination.Items = types.Int64Value(int64(*resp.Pagination.Items)) - } else { - r.Pagination.Items = types.Int64Null() - } - if resp.Pagination.Last != nil { - r.Pagination.Last = types.Int64Value(int64(*resp.Pagination.Last)) - } else { - r.Pagination.Last = types.Int64Null() - } - if resp.Pagination.Next != nil { - r.Pagination.Next = types.Int64Value(int64(*resp.Pagination.Next)) - } else { - r.Pagination.Next = types.Int64Null() - } - if resp.Pagination.Page != nil { - r.Pagination.Page = types.Int64Value(int64(*resp.Pagination.Page)) - } else { - r.Pagination.Page = types.Int64Null() - } - if resp.Pagination.Pages != nil { - r.Pagination.Pages = types.Int64Value(int64(*resp.Pagination.Pages)) - } else { - r.Pagination.Pages = types.Int64Null() - } - if resp.Pagination.Prev != nil { - r.Pagination.Prev = types.Int64Value(int64(*resp.Pagination.Prev)) - } else { - r.Pagination.Prev = types.Int64Null() - } - } - } -} diff --git a/internal/provider/functionalities_data_source.go b/internal/provider/functionalities_data_source.go deleted file mode 100644 index b2895ac..0000000 --- a/internal/provider/functionalities_data_source.go +++ /dev/null @@ -1,353 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &FunctionalitiesDataSource{} -var _ datasource.DataSourceWithConfigure = &FunctionalitiesDataSource{} - -func NewFunctionalitiesDataSource() datasource.DataSource { - return &FunctionalitiesDataSource{} -} - -// FunctionalitiesDataSource is the data source implementation. -type FunctionalitiesDataSource struct { - client *sdk.Firehydrant -} - -// FunctionalitiesDataSourceModel describes the data model. -type FunctionalitiesDataSourceModel struct { - Data []tfTypes.FunctionalityEntity `tfsdk:"data"` - Impacted types.String `tfsdk:"impacted"` - Labels types.String `tfsdk:"labels"` - Lite types.Bool `tfsdk:"lite"` - Name types.String `tfsdk:"name"` - Owner types.String `tfsdk:"owner"` - Page types.Int64 `tfsdk:"page"` - Pagination *tfTypes.PaginationEntity `tfsdk:"pagination"` - PerPage types.Int64 `tfsdk:"per_page"` - Query types.String `tfsdk:"query"` -} - -// Metadata returns the data source type name. -func (r *FunctionalitiesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_functionalities" -} - -// Schema defines the schema for the data source. -func (r *FunctionalitiesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Functionalities DataSource", - - Attributes: map[string]schema.Attribute{ - "data": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "impacted": schema.StringAttribute{ - Optional: true, - Description: `A query to search services by if they are impacted with active incidents`, - }, - "labels": schema.StringAttribute{ - Optional: true, - Description: `A comma separated list of label key / values in the format of 'key=value,key2=value2'. To filter change events that have a key (with no specific value), omit the value`, - }, - "lite": schema.BoolAttribute{ - Optional: true, - Description: `Boolean to determine whether to return a slimified version of the functionalities object`, - }, - "name": schema.StringAttribute{ - Optional: true, - Description: `A query to search functionalities by their name`, - }, - "owner": schema.StringAttribute{ - Optional: true, - Description: `A query to search functionalities by their owning team ID`, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "pagination": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "count": schema.Int64Attribute{ - Computed: true, - }, - "items": schema.Int64Attribute{ - Computed: true, - }, - "last": schema.Int64Attribute{ - Computed: true, - }, - "next": schema.Int64Attribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Computed: true, - }, - "pages": schema.Int64Attribute{ - Computed: true, - }, - "prev": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "query": schema.StringAttribute{ - Optional: true, - Description: `A query to search functionalities by their name or description`, - }, - }, - } -} - -func (r *FunctionalitiesDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *FunctionalitiesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *FunctionalitiesDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - query := new(string) - if !data.Query.IsUnknown() && !data.Query.IsNull() { - *query = data.Query.ValueString() - } else { - query = nil - } - name := new(string) - if !data.Name.IsUnknown() && !data.Name.IsNull() { - *name = data.Name.ValueString() - } else { - name = nil - } - impacted := new(string) - if !data.Impacted.IsUnknown() && !data.Impacted.IsNull() { - *impacted = data.Impacted.ValueString() - } else { - impacted = nil - } - labels := new(string) - if !data.Labels.IsUnknown() && !data.Labels.IsNull() { - *labels = data.Labels.ValueString() - } else { - labels = nil - } - owner := new(string) - if !data.Owner.IsUnknown() && !data.Owner.IsNull() { - *owner = data.Owner.ValueString() - } else { - owner = nil - } - lite := new(bool) - if !data.Lite.IsUnknown() && !data.Lite.IsNull() { - *lite = data.Lite.ValueBool() - } else { - lite = nil - } - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - request := operations.GetV1FunctionalitiesRequest{ - Query: query, - Name: name, - Impacted: impacted, - Labels: labels, - Owner: owner, - Lite: lite, - Page: page, - PerPage: perPage, - } - res, err := r.client.Functionalities.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.FunctionalityEntityPaginated != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedFunctionalityEntityPaginated(res.FunctionalityEntityPaginated) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/functionalities_data_source_sdk.go b/internal/provider/functionalities_data_source_sdk.go deleted file mode 100644 index efa1cc4..0000000 --- a/internal/provider/functionalities_data_source_sdk.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *FunctionalitiesDataSourceModel) RefreshFromSharedFunctionalityEntityPaginated(resp *shared.FunctionalityEntityPaginated) { - if resp != nil { - r.Data = []tfTypes.FunctionalityEntity{} - if len(r.Data) > len(resp.Data) { - r.Data = r.Data[:len(resp.Data)] - } - for dataCount, dataItem := range resp.Data { - var data1 tfTypes.FunctionalityEntity - data1.ActiveIncidents = []types.String{} - for _, v := range dataItem.ActiveIncidents { - data1.ActiveIncidents = append(data1.ActiveIncidents, types.StringValue(v)) - } - data1.AlertOnAdd = types.BoolPointerValue(dataItem.AlertOnAdd) - data1.AutoAddRespondingTeam = types.BoolPointerValue(dataItem.AutoAddRespondingTeam) - if dataItem.CreatedAt != nil { - data1.CreatedAt = types.StringValue(dataItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.CreatedAt = types.StringNull() - } - data1.Description = types.StringPointerValue(dataItem.Description) - data1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range dataItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(data1.ExternalResources) { - data1.ExternalResources = append(data1.ExternalResources, externalResources1) - } else { - data1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - data1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - data1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - data1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - data1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - data1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - data1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - data1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - data1.ID = types.StringPointerValue(dataItem.ID) - if len(dataItem.Labels) > 0 { - data1.Labels = make(map[string]types.String) - for key, value := range dataItem.Labels { - data1.Labels[key] = types.StringValue(value) - } - } - data1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range dataItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(data1.Links) { - data1.Links = append(data1.Links, links1) - } else { - data1.Links[linksCount].HrefURL = links1.HrefURL - data1.Links[linksCount].IconURL = links1.IconURL - data1.Links[linksCount].ID = links1.ID - data1.Links[linksCount].Name = links1.Name - } - } - data1.Name = types.StringPointerValue(dataItem.Name) - if dataItem.Owner == nil { - data1.Owner = nil - } else { - data1.Owner = &tfTypes.TeamEntity1{} - } - data1.Slug = types.StringPointerValue(dataItem.Slug) - if dataItem.UpdatedAt != nil { - data1.UpdatedAt = types.StringValue(dataItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.UpdatedAt = types.StringNull() - } - if dataItem.UpdatedBy == nil { - data1.UpdatedBy = nil - } else { - data1.UpdatedBy = &tfTypes.AuthorEntity{} - data1.UpdatedBy.Email = types.StringPointerValue(dataItem.UpdatedBy.Email) - data1.UpdatedBy.ID = types.StringPointerValue(dataItem.UpdatedBy.ID) - data1.UpdatedBy.Name = types.StringPointerValue(dataItem.UpdatedBy.Name) - data1.UpdatedBy.Source = types.StringPointerValue(dataItem.UpdatedBy.Source) - } - if dataCount+1 > len(r.Data) { - r.Data = append(r.Data, data1) - } else { - r.Data[dataCount].ActiveIncidents = data1.ActiveIncidents - r.Data[dataCount].AlertOnAdd = data1.AlertOnAdd - r.Data[dataCount].AutoAddRespondingTeam = data1.AutoAddRespondingTeam - r.Data[dataCount].CreatedAt = data1.CreatedAt - r.Data[dataCount].Description = data1.Description - r.Data[dataCount].ExternalResources = data1.ExternalResources - r.Data[dataCount].ID = data1.ID - r.Data[dataCount].Labels = data1.Labels - r.Data[dataCount].Links = data1.Links - r.Data[dataCount].Name = data1.Name - r.Data[dataCount].Owner = data1.Owner - r.Data[dataCount].Slug = data1.Slug - r.Data[dataCount].UpdatedAt = data1.UpdatedAt - r.Data[dataCount].UpdatedBy = data1.UpdatedBy - } - } - if resp.Pagination == nil { - r.Pagination = nil - } else { - r.Pagination = &tfTypes.PaginationEntity{} - if resp.Pagination.Count != nil { - r.Pagination.Count = types.Int64Value(int64(*resp.Pagination.Count)) - } else { - r.Pagination.Count = types.Int64Null() - } - if resp.Pagination.Items != nil { - r.Pagination.Items = types.Int64Value(int64(*resp.Pagination.Items)) - } else { - r.Pagination.Items = types.Int64Null() - } - if resp.Pagination.Last != nil { - r.Pagination.Last = types.Int64Value(int64(*resp.Pagination.Last)) - } else { - r.Pagination.Last = types.Int64Null() - } - if resp.Pagination.Next != nil { - r.Pagination.Next = types.Int64Value(int64(*resp.Pagination.Next)) - } else { - r.Pagination.Next = types.Int64Null() - } - if resp.Pagination.Page != nil { - r.Pagination.Page = types.Int64Value(int64(*resp.Pagination.Page)) - } else { - r.Pagination.Page = types.Int64Null() - } - if resp.Pagination.Pages != nil { - r.Pagination.Pages = types.Int64Value(int64(*resp.Pagination.Pages)) - } else { - r.Pagination.Pages = types.Int64Null() - } - if resp.Pagination.Prev != nil { - r.Pagination.Prev = types.Int64Value(int64(*resp.Pagination.Prev)) - } else { - r.Pagination.Prev = types.Int64Null() - } - } - } -} diff --git a/internal/provider/functionality_data_source.go b/internal/provider/functionality_data_source.go deleted file mode 100644 index 83c1a7d..0000000 --- a/internal/provider/functionality_data_source.go +++ /dev/null @@ -1,242 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &FunctionalityDataSource{} -var _ datasource.DataSourceWithConfigure = &FunctionalityDataSource{} - -func NewFunctionalityDataSource() datasource.DataSource { - return &FunctionalityDataSource{} -} - -// FunctionalityDataSource is the data source implementation. -type FunctionalityDataSource struct { - client *sdk.Firehydrant -} - -// FunctionalityDataSourceModel describes the data model. -type FunctionalityDataSourceModel struct { - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []tfTypes.ExternalResourceEntity `tfsdk:"external_resources"` - ID types.String `tfsdk:"id"` - Labels map[string]types.String `tfsdk:"labels"` - Links []tfTypes.LinksEntity `tfsdk:"links"` - Name types.String `tfsdk:"name"` - Owner *tfTypes.TeamEntity1 `tfsdk:"owner"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` - UpdatedBy *tfTypes.AuthorEntity `tfsdk:"updated_by"` -} - -// Metadata returns the data source type name. -func (r *FunctionalityDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_functionality" -} - -// Schema defines the schema for the data source. -func (r *FunctionalityDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Functionality DataSource", - - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - } -} - -func (r *FunctionalityDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *FunctionalityDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *FunctionalityDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var functionalityID string - functionalityID = data.ID.ValueString() - - request := operations.GetV1FunctionalitiesFunctionalityIDRequest{ - FunctionalityID: functionalityID, - } - res, err := r.client.Functionalities.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.FunctionalityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedFunctionalityEntity(res.FunctionalityEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/functionality_data_source_sdk.go b/internal/provider/functionality_data_source_sdk.go deleted file mode 100644 index 485a704..0000000 --- a/internal/provider/functionality_data_source_sdk.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *FunctionalityDataSourceModel) RefreshFromSharedFunctionalityEntity(resp *shared.FunctionalityEntity) { - if resp != nil { - r.ActiveIncidents = []types.String{} - for _, v := range resp.ActiveIncidents { - r.ActiveIncidents = append(r.ActiveIncidents, types.StringValue(v)) - } - r.AlertOnAdd = types.BoolPointerValue(resp.AlertOnAdd) - r.AutoAddRespondingTeam = types.BoolPointerValue(resp.AutoAddRespondingTeam) - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.Description = types.StringPointerValue(resp.Description) - r.ExternalResources = []tfTypes.ExternalResourceEntity{} - if len(r.ExternalResources) > len(resp.ExternalResources) { - r.ExternalResources = r.ExternalResources[:len(resp.ExternalResources)] - } - for externalResourcesCount, externalResourcesItem := range resp.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(r.ExternalResources) { - r.ExternalResources = append(r.ExternalResources, externalResources1) - } else { - r.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - r.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - r.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - r.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - r.ExternalResources[externalResourcesCount].Name = externalResources1.Name - r.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - r.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - r.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - r.ID = types.StringPointerValue(resp.ID) - if len(resp.Labels) > 0 { - r.Labels = make(map[string]types.String) - for key, value := range resp.Labels { - r.Labels[key] = types.StringValue(value) - } - } - r.Links = []tfTypes.LinksEntity{} - if len(r.Links) > len(resp.Links) { - r.Links = r.Links[:len(resp.Links)] - } - for linksCount, linksItem := range resp.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(r.Links) { - r.Links = append(r.Links, links1) - } else { - r.Links[linksCount].HrefURL = links1.HrefURL - r.Links[linksCount].IconURL = links1.IconURL - r.Links[linksCount].ID = links1.ID - r.Links[linksCount].Name = links1.Name - } - } - r.Name = types.StringPointerValue(resp.Name) - if resp.Owner == nil { - r.Owner = nil - } else { - r.Owner = &tfTypes.TeamEntity1{} - } - r.Slug = types.StringPointerValue(resp.Slug) - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - if resp.UpdatedBy == nil { - r.UpdatedBy = nil - } else { - r.UpdatedBy = &tfTypes.AuthorEntity{} - r.UpdatedBy.Email = types.StringPointerValue(resp.UpdatedBy.Email) - r.UpdatedBy.ID = types.StringPointerValue(resp.UpdatedBy.ID) - r.UpdatedBy.Name = types.StringPointerValue(resp.UpdatedBy.Name) - r.UpdatedBy.Source = types.StringPointerValue(resp.UpdatedBy.Source) - } - } -} diff --git a/internal/provider/functionality_resource.go b/internal/provider/functionality_resource.go deleted file mode 100644 index 3223717..0000000 --- a/internal/provider/functionality_resource.go +++ /dev/null @@ -1,508 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - speakeasy_objectvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/objectvalidators" - speakeasy_stringvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/stringvalidators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &FunctionalityResource{} -var _ resource.ResourceWithImportState = &FunctionalityResource{} - -func NewFunctionalityResource() resource.Resource { - return &FunctionalityResource{} -} - -// FunctionalityResource defines the resource implementation. -type FunctionalityResource struct { - client *sdk.Firehydrant -} - -// FunctionalityResourceModel describes the resource data model. -type FunctionalityResourceModel struct { - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []tfTypes.ExternalResourceEntity1 `tfsdk:"external_resources"` - ID types.String `tfsdk:"id"` - Labels map[string]types.String `tfsdk:"labels"` - Links []tfTypes.LinksEntity1 `tfsdk:"links"` - Name types.String `tfsdk:"name"` - Owner *tfTypes.PostV1FunctionalitiesOwner `tfsdk:"owner"` - Services []tfTypes.PostV1FunctionalitiesOwner `tfsdk:"services"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` - UpdatedBy *tfTypes.AuthorEntity `tfsdk:"updated_by"` -} - -func (r *FunctionalityResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_functionality" -} - -func (r *FunctionalityResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Functionality Resource", - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - Optional: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - Optional: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `The integration slug for the external resource. Can be one of: github, opsgenie, pager_duty, statuspage, victorops. Not required if the resource has already been imported.`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `An array of external resources to attach to this service.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Description: `A hash of label keys and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `URL. Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `An optional URL to an icon representing this link`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Short name used to display and identify this link. Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - }, - }, - Description: `An array of links to associate with this service`, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - }, - Description: `An object representing a Team that owns the service`, - }, - "services": schema.ListNestedAttribute{ - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Required: true, - Description: `ID of a service`, - }, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - } -} - -func (r *FunctionalityResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *FunctionalityResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *FunctionalityResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1Functionalities() - res, err := r.client.Functionalities.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.FunctionalityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedFunctionalityEntity(res.FunctionalityEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var functionalityID string - functionalityID = data.ID.ValueString() - - request1 := operations.GetV1FunctionalitiesFunctionalityIDRequest{ - FunctionalityID: functionalityID, - } - res1, err := r.client.Functionalities.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.FunctionalityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedFunctionalityEntity(res1.FunctionalityEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *FunctionalityResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *FunctionalityResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var functionalityID string - functionalityID = data.ID.ValueString() - - request := operations.GetV1FunctionalitiesFunctionalityIDRequest{ - FunctionalityID: functionalityID, - } - res, err := r.client.Functionalities.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.FunctionalityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedFunctionalityEntity(res.FunctionalityEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *FunctionalityResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *FunctionalityResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var functionalityID string - functionalityID = data.ID.ValueString() - - patchV1FunctionalitiesFunctionalityID := *data.ToSharedPatchV1FunctionalitiesFunctionalityID() - request := operations.PatchV1FunctionalitiesFunctionalityIDRequest{ - FunctionalityID: functionalityID, - PatchV1FunctionalitiesFunctionalityID: patchV1FunctionalitiesFunctionalityID, - } - res, err := r.client.Functionalities.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.FunctionalityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedFunctionalityEntity(res.FunctionalityEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var functionalityId1 string - functionalityId1 = data.ID.ValueString() - - request1 := operations.GetV1FunctionalitiesFunctionalityIDRequest{ - FunctionalityID: functionalityId1, - } - res1, err := r.client.Functionalities.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.FunctionalityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedFunctionalityEntity(res1.FunctionalityEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *FunctionalityResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *FunctionalityResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var functionalityID string - functionalityID = data.ID.ValueString() - - request := operations.DeleteV1FunctionalitiesFunctionalityIDRequest{ - FunctionalityID: functionalityID, - } - res, err := r.client.Functionalities.Archive(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *FunctionalityResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/functionality_resource_sdk.go b/internal/provider/functionality_resource_sdk.go deleted file mode 100644 index 02d0dc9..0000000 --- a/internal/provider/functionality_resource_sdk.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *FunctionalityResourceModel) ToSharedPostV1Functionalities() *shared.PostV1Functionalities { - var name string - name = r.Name.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - var services []shared.Services = []shared.Services{} - for _, servicesItem := range r.Services { - var id string - id = servicesItem.ID.ValueString() - - services = append(services, shared.Services{ - ID: id, - }) - } - labels := make(map[string]string) - for labelsKey, labelsValue := range r.Labels { - var labelsInst string - labelsInst = labelsValue.ValueString() - - labels[labelsKey] = labelsInst - } - alertOnAdd := new(bool) - if !r.AlertOnAdd.IsUnknown() && !r.AlertOnAdd.IsNull() { - *alertOnAdd = r.AlertOnAdd.ValueBool() - } else { - alertOnAdd = nil - } - autoAddRespondingTeam := new(bool) - if !r.AutoAddRespondingTeam.IsUnknown() && !r.AutoAddRespondingTeam.IsNull() { - *autoAddRespondingTeam = r.AutoAddRespondingTeam.ValueBool() - } else { - autoAddRespondingTeam = nil - } - var externalResources []shared.PostV1FunctionalitiesExternalResources = []shared.PostV1FunctionalitiesExternalResources{} - for _, externalResourcesItem := range r.ExternalResources { - var remoteID string - remoteID = externalResourcesItem.RemoteID.ValueString() - - connectionType := new(string) - if !externalResourcesItem.ConnectionType.IsUnknown() && !externalResourcesItem.ConnectionType.IsNull() { - *connectionType = externalResourcesItem.ConnectionType.ValueString() - } else { - connectionType = nil - } - externalResources = append(externalResources, shared.PostV1FunctionalitiesExternalResources{ - RemoteID: remoteID, - ConnectionType: connectionType, - }) - } - var links []shared.PostV1FunctionalitiesLinks = []shared.PostV1FunctionalitiesLinks{} - for _, linksItem := range r.Links { - var name1 string - name1 = linksItem.Name.ValueString() - - var hrefURL string - hrefURL = linksItem.HrefURL.ValueString() - - iconURL := new(string) - if !linksItem.IconURL.IsUnknown() && !linksItem.IconURL.IsNull() { - *iconURL = linksItem.IconURL.ValueString() - } else { - iconURL = nil - } - links = append(links, shared.PostV1FunctionalitiesLinks{ - Name: name1, - HrefURL: hrefURL, - IconURL: iconURL, - }) - } - var owner *shared.PostV1FunctionalitiesOwner - if r.Owner != nil { - var id1 string - id1 = r.Owner.ID.ValueString() - - owner = &shared.PostV1FunctionalitiesOwner{ - ID: id1, - } - } - out := shared.PostV1Functionalities{ - Name: name, - Description: description, - Services: services, - Labels: labels, - AlertOnAdd: alertOnAdd, - AutoAddRespondingTeam: autoAddRespondingTeam, - ExternalResources: externalResources, - Links: links, - Owner: owner, - } - return &out -} - -func (r *FunctionalityResourceModel) RefreshFromSharedFunctionalityEntity(resp *shared.FunctionalityEntity) { - if resp != nil { - r.ActiveIncidents = []types.String{} - for _, v := range resp.ActiveIncidents { - r.ActiveIncidents = append(r.ActiveIncidents, types.StringValue(v)) - } - r.AlertOnAdd = types.BoolPointerValue(resp.AlertOnAdd) - r.AutoAddRespondingTeam = types.BoolPointerValue(resp.AutoAddRespondingTeam) - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.Description = types.StringPointerValue(resp.Description) - r.ExternalResources = []tfTypes.ExternalResourceEntity1{} - if len(r.ExternalResources) > len(resp.ExternalResources) { - r.ExternalResources = r.ExternalResources[:len(resp.ExternalResources)] - } - for externalResourcesCount, externalResourcesItem := range resp.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity1 - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(r.ExternalResources) { - r.ExternalResources = append(r.ExternalResources, externalResources1) - } else { - r.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - r.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - r.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - r.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - r.ExternalResources[externalResourcesCount].Name = externalResources1.Name - r.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - r.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - r.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - r.ID = types.StringPointerValue(resp.ID) - if len(resp.Labels) > 0 { - r.Labels = make(map[string]types.String) - for key, value := range resp.Labels { - r.Labels[key] = types.StringValue(value) - } - } - r.Links = []tfTypes.LinksEntity1{} - if len(r.Links) > len(resp.Links) { - r.Links = r.Links[:len(resp.Links)] - } - for linksCount, linksItem := range resp.Links { - var links1 tfTypes.LinksEntity1 - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(r.Links) { - r.Links = append(r.Links, links1) - } else { - r.Links[linksCount].HrefURL = links1.HrefURL - r.Links[linksCount].IconURL = links1.IconURL - r.Links[linksCount].ID = links1.ID - r.Links[linksCount].Name = links1.Name - } - } - r.Name = types.StringPointerValue(resp.Name) - if resp.Owner == nil { - r.Owner = nil - } else { - r.Owner = &tfTypes.PostV1FunctionalitiesOwner{} - } - r.Slug = types.StringPointerValue(resp.Slug) - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - if resp.UpdatedBy == nil { - r.UpdatedBy = nil - } else { - r.UpdatedBy = &tfTypes.AuthorEntity{} - r.UpdatedBy.Email = types.StringPointerValue(resp.UpdatedBy.Email) - r.UpdatedBy.ID = types.StringPointerValue(resp.UpdatedBy.ID) - r.UpdatedBy.Name = types.StringPointerValue(resp.UpdatedBy.Name) - r.UpdatedBy.Source = types.StringPointerValue(resp.UpdatedBy.Source) - } - } -} - -func (r *FunctionalityResourceModel) ToSharedPatchV1FunctionalitiesFunctionalityID() *shared.PatchV1FunctionalitiesFunctionalityID { - name := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name = r.Name.ValueString() - } else { - name = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - var services []shared.PatchV1FunctionalitiesFunctionalityIDServices = []shared.PatchV1FunctionalitiesFunctionalityIDServices{} - for _, servicesItem := range r.Services { - var id string - id = servicesItem.ID.ValueString() - - services = append(services, shared.PatchV1FunctionalitiesFunctionalityIDServices{ - ID: id, - }) - } - var links []shared.PatchV1FunctionalitiesFunctionalityIDLinks = []shared.PatchV1FunctionalitiesFunctionalityIDLinks{} - for _, linksItem := range r.Links { - var hrefURL string - hrefURL = linksItem.HrefURL.ValueString() - - var name1 string - name1 = linksItem.Name.ValueString() - - iconURL := new(string) - if !linksItem.IconURL.IsUnknown() && !linksItem.IconURL.IsNull() { - *iconURL = linksItem.IconURL.ValueString() - } else { - iconURL = nil - } - // Functionality#update.links.removeFunctionality#update.links.remove impedance mismatch: boolean != stringtrace=["Functionality#create.req.links.[].name"] - var remove *bool - id1 := new(string) - if !linksItem.ID.IsUnknown() && !linksItem.ID.IsNull() { - *id1 = linksItem.ID.ValueString() - } else { - id1 = nil - } - links = append(links, shared.PatchV1FunctionalitiesFunctionalityIDLinks{ - HrefURL: hrefURL, - Name: name1, - IconURL: iconURL, - Remove: remove, - ID: id1, - }) - } - var owner *shared.PatchV1FunctionalitiesFunctionalityIDOwner - if r.Owner != nil { - var id2 string - id2 = r.Owner.ID.ValueString() - - owner = &shared.PatchV1FunctionalitiesFunctionalityIDOwner{ - ID: id2, - } - } - var externalResources []shared.PatchV1FunctionalitiesFunctionalityIDExternalResources = []shared.PatchV1FunctionalitiesFunctionalityIDExternalResources{} - for _, externalResourcesItem := range r.ExternalResources { - var remoteID string - remoteID = externalResourcesItem.RemoteID.ValueString() - - connectionType := new(string) - if !externalResourcesItem.ConnectionType.IsUnknown() && !externalResourcesItem.ConnectionType.IsNull() { - *connectionType = externalResourcesItem.ConnectionType.ValueString() - } else { - connectionType = nil - } - // Functionality#update.external_resources.removeFunctionality#update.external_resources.remove impedance mismatch: boolean != stringtrace=["Functionality#create.req.external_resources.[].connection_type"] - var remove1 *bool - externalResources = append(externalResources, shared.PatchV1FunctionalitiesFunctionalityIDExternalResources{ - RemoteID: remoteID, - ConnectionType: connectionType, - Remove: remove1, - }) - } - labels := make(map[string]string) - for labelsKey, labelsValue := range r.Labels { - var labelsInst string - labelsInst = labelsValue.ValueString() - - labels[labelsKey] = labelsInst - } - alertOnAdd := new(bool) - if !r.AlertOnAdd.IsUnknown() && !r.AlertOnAdd.IsNull() { - *alertOnAdd = r.AlertOnAdd.ValueBool() - } else { - alertOnAdd = nil - } - autoAddRespondingTeam := new(bool) - if !r.AutoAddRespondingTeam.IsUnknown() && !r.AutoAddRespondingTeam.IsNull() { - *autoAddRespondingTeam = r.AutoAddRespondingTeam.ValueBool() - } else { - autoAddRespondingTeam = nil - } - out := shared.PatchV1FunctionalitiesFunctionalityID{ - Name: name, - Description: description, - Services: services, - Links: links, - Owner: owner, - ExternalResources: externalResources, - Labels: labels, - AlertOnAdd: alertOnAdd, - AutoAddRespondingTeam: autoAddRespondingTeam, - } - return &out -} diff --git a/internal/provider/incidentrole_data_source.go b/internal/provider/incidentrole_data_source.go deleted file mode 100644 index 700fcd0..0000000 --- a/internal/provider/incidentrole_data_source.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &IncidentRoleDataSource{} -var _ datasource.DataSourceWithConfigure = &IncidentRoleDataSource{} - -func NewIncidentRoleDataSource() datasource.DataSource { - return &IncidentRoleDataSource{} -} - -// IncidentRoleDataSource is the data source implementation. -type IncidentRoleDataSource struct { - client *sdk.Firehydrant -} - -// IncidentRoleDataSourceModel describes the data model. -type IncidentRoleDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - DiscardedAt types.String `tfsdk:"discarded_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Summary types.String `tfsdk:"summary"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *IncidentRoleDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_incident_role" -} - -// Schema defines the schema for the data source. -func (r *IncidentRoleDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "IncidentRole DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *IncidentRoleDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *IncidentRoleDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *IncidentRoleDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var incidentRoleID string - incidentRoleID = data.ID.ValueString() - - request := operations.GetV1IncidentRolesIncidentRoleIDRequest{ - IncidentRoleID: incidentRoleID, - } - res, err := r.client.IncidentRoles.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/incidentrole_data_source_sdk.go b/internal/provider/incidentrole_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/incidentrole_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/incidentrole_resource.go b/internal/provider/incidentrole_resource.go deleted file mode 100644 index e45a6a8..0000000 --- a/internal/provider/incidentrole_resource.go +++ /dev/null @@ -1,285 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &IncidentRoleResource{} -var _ resource.ResourceWithImportState = &IncidentRoleResource{} - -func NewIncidentRoleResource() resource.Resource { - return &IncidentRoleResource{} -} - -// IncidentRoleResource defines the resource implementation. -type IncidentRoleResource struct { - client *sdk.Firehydrant -} - -// IncidentRoleResourceModel describes the resource data model. -type IncidentRoleResourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - DiscardedAt types.String `tfsdk:"discarded_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Summary types.String `tfsdk:"summary"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *IncidentRoleResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_incident_role" -} - -func (r *IncidentRoleResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "IncidentRole Resource", - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "summary": schema.StringAttribute{ - Required: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *IncidentRoleResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *IncidentRoleResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *IncidentRoleResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1IncidentRoles() - res, err := r.client.IncidentRoles.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *IncidentRoleResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *IncidentRoleResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var incidentRoleID string - incidentRoleID = data.ID.ValueString() - - request := operations.GetV1IncidentRolesIncidentRoleIDRequest{ - IncidentRoleID: incidentRoleID, - } - res, err := r.client.IncidentRoles.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *IncidentRoleResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *IncidentRoleResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var incidentRoleID string - incidentRoleID = data.ID.ValueString() - - patchV1IncidentRolesIncidentRoleID := *data.ToSharedPatchV1IncidentRolesIncidentRoleID() - request := operations.PatchV1IncidentRolesIncidentRoleIDRequest{ - IncidentRoleID: incidentRoleID, - PatchV1IncidentRolesIncidentRoleID: patchV1IncidentRolesIncidentRoleID, - } - res, err := r.client.IncidentRoles.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *IncidentRoleResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *IncidentRoleResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var incidentRoleID string - incidentRoleID = data.ID.ValueString() - - request := operations.DeleteV1IncidentRolesIncidentRoleIDRequest{ - IncidentRoleID: incidentRoleID, - } - res, err := r.client.IncidentRoles.Archive(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *IncidentRoleResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/incidentrole_resource_sdk.go b/internal/provider/incidentrole_resource_sdk.go deleted file mode 100644 index 692e5b6..0000000 --- a/internal/provider/incidentrole_resource_sdk.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" -) - -func (r *IncidentRoleResourceModel) ToSharedPostV1IncidentRoles() *shared.PostV1IncidentRoles { - var name string - name = r.Name.ValueString() - - var summary string - summary = r.Summary.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - out := shared.PostV1IncidentRoles{ - Name: name, - Summary: summary, - Description: description, - } - return &out -} - -func (r *IncidentRoleResourceModel) ToSharedPatchV1IncidentRolesIncidentRoleID() *shared.PatchV1IncidentRolesIncidentRoleID { - name := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name = r.Name.ValueString() - } else { - name = nil - } - summary := new(string) - if !r.Summary.IsUnknown() && !r.Summary.IsNull() { - *summary = r.Summary.ValueString() - } else { - summary = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - out := shared.PatchV1IncidentRolesIncidentRoleID{ - Name: name, - Summary: summary, - Description: description, - } - return &out -} diff --git a/internal/provider/incidenttype_data_source.go b/internal/provider/incidenttype_data_source.go deleted file mode 100644 index 339a661..0000000 --- a/internal/provider/incidenttype_data_source.go +++ /dev/null @@ -1,735 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &IncidentTypeDataSource{} -var _ datasource.DataSourceWithConfigure = &IncidentTypeDataSource{} - -func NewIncidentTypeDataSource() datasource.DataSource { - return &IncidentTypeDataSource{} -} - -// IncidentTypeDataSource is the data source implementation. -type IncidentTypeDataSource struct { - client *sdk.Firehydrant -} - -// IncidentTypeDataSourceModel describes the data model. -type IncidentTypeDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Template *tfTypes.IncidentTypeEntityTemplateEntity `tfsdk:"template"` - TemplateValues *tfTypes.IncidentTypeEntityTemplateValuesEntity `tfsdk:"template_values"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *IncidentTypeDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_incident_type" -} - -// Schema defines the schema for the data source. -func (r *IncidentTypeDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "IncidentType DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Required: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "template": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "custom_fields": schema.StringAttribute{ - Computed: true, - }, - "customer_impact_summary": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "impacts": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "incident_name": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `Arbitrary key:value pairs of labels for your incidents.`, - }, - "priority": schema.StringAttribute{ - Computed: true, - }, - "private_incident": schema.BoolAttribute{ - Computed: true, - }, - "runbook_ids": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "severity": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "tag_list": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "team_ids": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - }, - }, - "template_values": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "environments": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "runbooks": schema.SingleNestedAttribute{ - Computed: true, - Description: `A hash mapping runbook IDs to runbook names.`, - }, - "services": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *IncidentTypeDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *IncidentTypeDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *IncidentTypeDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - request := operations.GetV1IncidentTypesIDRequest{ - ID: id, - } - res, err := r.client.IncidentTypes.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.IncidentTypeEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedIncidentTypeEntity(res.IncidentTypeEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/incidenttype_data_source_sdk.go b/internal/provider/incidenttype_data_source_sdk.go deleted file mode 100644 index b56b69d..0000000 --- a/internal/provider/incidenttype_data_source_sdk.go +++ /dev/null @@ -1,582 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *IncidentTypeDataSourceModel) RefreshFromSharedIncidentTypeEntity(resp *shared.IncidentTypeEntity) { - if resp != nil { - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.ID = types.StringPointerValue(resp.ID) - r.Name = types.StringPointerValue(resp.Name) - if resp.Template == nil { - r.Template = nil - } else { - r.Template = &tfTypes.IncidentTypeEntityTemplateEntity{} - r.Template.CustomFields = types.StringPointerValue(resp.Template.CustomFields) - r.Template.CustomerImpactSummary = types.StringPointerValue(resp.Template.CustomerImpactSummary) - r.Template.Description = types.StringPointerValue(resp.Template.Description) - r.Template.Impacts = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - if len(r.Template.Impacts) > len(resp.Template.Impacts) { - r.Template.Impacts = r.Template.Impacts[:len(resp.Template.Impacts)] - } - for impactsCount, impactsItem := range resp.Template.Impacts { - var impacts1 tfTypes.IncidentTypeEntityTemplateImpactEntity - impacts1.ConditionID = types.StringPointerValue(impactsItem.ConditionID) - impacts1.ConditionName = types.StringPointerValue(impactsItem.ConditionName) - impacts1.ID = types.StringPointerValue(impactsItem.ID) - impacts1.Name = types.StringPointerValue(impactsItem.Name) - if impactsItem.Type != nil { - impacts1.Type = types.StringValue(string(*impactsItem.Type)) - } else { - impacts1.Type = types.StringNull() - } - if impactsCount+1 > len(r.Template.Impacts) { - r.Template.Impacts = append(r.Template.Impacts, impacts1) - } else { - r.Template.Impacts[impactsCount].ConditionID = impacts1.ConditionID - r.Template.Impacts[impactsCount].ConditionName = impacts1.ConditionName - r.Template.Impacts[impactsCount].ID = impacts1.ID - r.Template.Impacts[impactsCount].Name = impacts1.Name - r.Template.Impacts[impactsCount].Type = impacts1.Type - } - } - r.Template.IncidentName = types.StringPointerValue(resp.Template.IncidentName) - if len(resp.Template.Labels) > 0 { - r.Template.Labels = make(map[string]types.String) - for key, value := range resp.Template.Labels { - r.Template.Labels[key] = types.StringValue(value) - } - } - r.Template.Priority = types.StringPointerValue(resp.Template.Priority) - r.Template.PrivateIncident = types.BoolPointerValue(resp.Template.PrivateIncident) - r.Template.RunbookIds = []types.String{} - for _, v := range resp.Template.RunbookIds { - r.Template.RunbookIds = append(r.Template.RunbookIds, types.StringValue(v)) - } - r.Template.Severity = types.StringPointerValue(resp.Template.Severity) - r.Template.Summary = types.StringPointerValue(resp.Template.Summary) - r.Template.TagList = []types.String{} - for _, v := range resp.Template.TagList { - r.Template.TagList = append(r.Template.TagList, types.StringValue(v)) - } - r.Template.TeamIds = []types.String{} - for _, v := range resp.Template.TeamIds { - r.Template.TeamIds = append(r.Template.TeamIds, types.StringValue(v)) - } - } - if resp.TemplateValues == nil { - r.TemplateValues = nil - } else { - r.TemplateValues = &tfTypes.IncidentTypeEntityTemplateValuesEntity{} - r.TemplateValues.Environments = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - if len(r.TemplateValues.Environments) > len(resp.TemplateValues.Environments) { - r.TemplateValues.Environments = r.TemplateValues.Environments[:len(resp.TemplateValues.Environments)] - } - for environmentsCount, environmentsItem := range resp.TemplateValues.Environments { - var environments1 tfTypes.IncidentTypeEntityTemplateImpactEntity - environments1.ConditionID = types.StringPointerValue(environmentsItem.ConditionID) - environments1.ConditionName = types.StringPointerValue(environmentsItem.ConditionName) - environments1.ID = types.StringPointerValue(environmentsItem.ID) - environments1.Name = types.StringPointerValue(environmentsItem.Name) - if environmentsItem.Type != nil { - environments1.Type = types.StringValue(string(*environmentsItem.Type)) - } else { - environments1.Type = types.StringNull() - } - if environmentsCount+1 > len(r.TemplateValues.Environments) { - r.TemplateValues.Environments = append(r.TemplateValues.Environments, environments1) - } else { - r.TemplateValues.Environments[environmentsCount].ConditionID = environments1.ConditionID - r.TemplateValues.Environments[environmentsCount].ConditionName = environments1.ConditionName - r.TemplateValues.Environments[environmentsCount].ID = environments1.ID - r.TemplateValues.Environments[environmentsCount].Name = environments1.Name - r.TemplateValues.Environments[environmentsCount].Type = environments1.Type - } - } - r.TemplateValues.Functionalities = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - if len(r.TemplateValues.Functionalities) > len(resp.TemplateValues.Functionalities) { - r.TemplateValues.Functionalities = r.TemplateValues.Functionalities[:len(resp.TemplateValues.Functionalities)] - } - for functionalitiesCount, functionalitiesItem := range resp.TemplateValues.Functionalities { - var functionalities1 tfTypes.IncidentTypeEntityTemplateImpactEntity - functionalities1.ConditionID = types.StringPointerValue(functionalitiesItem.ConditionID) - functionalities1.ConditionName = types.StringPointerValue(functionalitiesItem.ConditionName) - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Type != nil { - functionalities1.Type = types.StringValue(string(*functionalitiesItem.Type)) - } else { - functionalities1.Type = types.StringNull() - } - if functionalitiesCount+1 > len(r.TemplateValues.Functionalities) { - r.TemplateValues.Functionalities = append(r.TemplateValues.Functionalities, functionalities1) - } else { - r.TemplateValues.Functionalities[functionalitiesCount].ConditionID = functionalities1.ConditionID - r.TemplateValues.Functionalities[functionalitiesCount].ConditionName = functionalities1.ConditionName - r.TemplateValues.Functionalities[functionalitiesCount].ID = functionalities1.ID - r.TemplateValues.Functionalities[functionalitiesCount].Name = functionalities1.Name - r.TemplateValues.Functionalities[functionalitiesCount].Type = functionalities1.Type - } - } - if resp.TemplateValues.Runbooks == nil { - r.TemplateValues.Runbooks = nil - } else { - r.TemplateValues.Runbooks = &tfTypes.TeamEntity1{} - } - r.TemplateValues.Services = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - if len(r.TemplateValues.Services) > len(resp.TemplateValues.Services) { - r.TemplateValues.Services = r.TemplateValues.Services[:len(resp.TemplateValues.Services)] - } - for servicesCount, servicesItem := range resp.TemplateValues.Services { - var services1 tfTypes.IncidentTypeEntityTemplateImpactEntity - services1.ConditionID = types.StringPointerValue(servicesItem.ConditionID) - services1.ConditionName = types.StringPointerValue(servicesItem.ConditionName) - services1.ID = types.StringPointerValue(servicesItem.ID) - services1.Name = types.StringPointerValue(servicesItem.Name) - if servicesItem.Type != nil { - services1.Type = types.StringValue(string(*servicesItem.Type)) - } else { - services1.Type = types.StringNull() - } - if servicesCount+1 > len(r.TemplateValues.Services) { - r.TemplateValues.Services = append(r.TemplateValues.Services, services1) - } else { - r.TemplateValues.Services[servicesCount].ConditionID = services1.ConditionID - r.TemplateValues.Services[servicesCount].ConditionName = services1.ConditionName - r.TemplateValues.Services[servicesCount].ID = services1.ID - r.TemplateValues.Services[servicesCount].Name = services1.Name - r.TemplateValues.Services[servicesCount].Type = services1.Type - } - } - r.TemplateValues.Teams = []tfTypes.TeamEntity{} - if len(r.TemplateValues.Teams) > len(resp.TemplateValues.Teams) { - r.TemplateValues.Teams = r.TemplateValues.Teams[:len(resp.TemplateValues.Teams)] - } - for teamsCount, teamsItem := range resp.TemplateValues.Teams { - var teams1 tfTypes.TeamEntity - if teamsItem.CreatedAt != nil { - teams1.CreatedAt = types.StringValue(teamsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams1.CreatedAt = types.StringNull() - } - if teamsItem.CreatedBy == nil { - teams1.CreatedBy = nil - } else { - teams1.CreatedBy = &tfTypes.AuthorEntity{} - teams1.CreatedBy.Email = types.StringPointerValue(teamsItem.CreatedBy.Email) - teams1.CreatedBy.ID = types.StringPointerValue(teamsItem.CreatedBy.ID) - teams1.CreatedBy.Name = types.StringPointerValue(teamsItem.CreatedBy.Name) - teams1.CreatedBy.Source = types.StringPointerValue(teamsItem.CreatedBy.Source) - } - teams1.Description = types.StringPointerValue(teamsItem.Description) - teams1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount1, functionalitiesItem1 := range teamsItem.Functionalities { - var functionalities3 tfTypes.FunctionalityEntity - functionalities3.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem1.ActiveIncidents { - functionalities3.ActiveIncidents = append(functionalities3.ActiveIncidents, types.StringValue(v)) - } - functionalities3.AlertOnAdd = types.BoolPointerValue(functionalitiesItem1.AlertOnAdd) - functionalities3.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem1.AutoAddRespondingTeam) - if functionalitiesItem1.CreatedAt != nil { - functionalities3.CreatedAt = types.StringValue(functionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.CreatedAt = types.StringNull() - } - functionalities3.Description = types.StringPointerValue(functionalitiesItem1.Description) - functionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem1.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities3.ExternalResources) { - functionalities3.ExternalResources = append(functionalities3.ExternalResources, externalResources1) - } else { - functionalities3.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities3.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities3.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities3.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities3.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities3.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities3.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities3.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities3.ID = types.StringPointerValue(functionalitiesItem1.ID) - if len(functionalitiesItem1.Labels) > 0 { - functionalities3.Labels = make(map[string]types.String) - for key1, value1 := range functionalitiesItem1.Labels { - functionalities3.Labels[key1] = types.StringValue(value1) - } - } - functionalities3.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem1.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities3.Links) { - functionalities3.Links = append(functionalities3.Links, links1) - } else { - functionalities3.Links[linksCount].HrefURL = links1.HrefURL - functionalities3.Links[linksCount].IconURL = links1.IconURL - functionalities3.Links[linksCount].ID = links1.ID - functionalities3.Links[linksCount].Name = links1.Name - } - } - functionalities3.Name = types.StringPointerValue(functionalitiesItem1.Name) - if functionalitiesItem1.Owner == nil { - functionalities3.Owner = nil - } else { - functionalities3.Owner = &tfTypes.TeamEntity1{} - } - functionalities3.Slug = types.StringPointerValue(functionalitiesItem1.Slug) - if functionalitiesItem1.UpdatedAt != nil { - functionalities3.UpdatedAt = types.StringValue(functionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.UpdatedAt = types.StringNull() - } - if functionalitiesItem1.UpdatedBy == nil { - functionalities3.UpdatedBy = nil - } else { - functionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities3.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Email) - functionalities3.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem1.UpdatedBy.ID) - functionalities3.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Name) - functionalities3.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Source) - } - if functionalitiesCount1+1 > len(teams1.Functionalities) { - teams1.Functionalities = append(teams1.Functionalities, functionalities3) - } else { - teams1.Functionalities[functionalitiesCount1].ActiveIncidents = functionalities3.ActiveIncidents - teams1.Functionalities[functionalitiesCount1].AlertOnAdd = functionalities3.AlertOnAdd - teams1.Functionalities[functionalitiesCount1].AutoAddRespondingTeam = functionalities3.AutoAddRespondingTeam - teams1.Functionalities[functionalitiesCount1].CreatedAt = functionalities3.CreatedAt - teams1.Functionalities[functionalitiesCount1].Description = functionalities3.Description - teams1.Functionalities[functionalitiesCount1].ExternalResources = functionalities3.ExternalResources - teams1.Functionalities[functionalitiesCount1].ID = functionalities3.ID - teams1.Functionalities[functionalitiesCount1].Labels = functionalities3.Labels - teams1.Functionalities[functionalitiesCount1].Links = functionalities3.Links - teams1.Functionalities[functionalitiesCount1].Name = functionalities3.Name - teams1.Functionalities[functionalitiesCount1].Owner = functionalities3.Owner - teams1.Functionalities[functionalitiesCount1].Slug = functionalities3.Slug - teams1.Functionalities[functionalitiesCount1].UpdatedAt = functionalities3.UpdatedAt - teams1.Functionalities[functionalitiesCount1].UpdatedBy = functionalities3.UpdatedBy - } - } - teams1.ID = types.StringPointerValue(teamsItem.ID) - teams1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range teamsItem.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(teams1.Memberships) { - teams1.Memberships = append(teams1.Memberships, memberships1) - } else { - teams1.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - teams1.Memberships[membershipsCount].Schedule = memberships1.Schedule - teams1.Memberships[membershipsCount].User = memberships1.User - } - } - if teamsItem.MsTeamsChannel == nil { - teams1.MsTeamsChannel = nil - } else { - teams1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams1.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelID) - teams1.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelName) - teams1.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelURL) - teams1.MsTeamsChannel.ID = types.StringPointerValue(teamsItem.MsTeamsChannel.ID) - teams1.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem.MsTeamsChannel.MsTeamID) - teams1.MsTeamsChannel.Status = types.StringPointerValue(teamsItem.MsTeamsChannel.Status) - teams1.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem.MsTeamsChannel.TeamName) - } - teams1.Name = types.StringPointerValue(teamsItem.Name) - teams1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range teamsItem.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key2, value2 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key2] = types.StringValue(value2) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(teams1.OwnedFunctionalities) { - teams1.OwnedFunctionalities = append(teams1.OwnedFunctionalities, ownedFunctionalities1) - } else { - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - teams1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range teamsItem.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(teams1.OwnedRunbooks) { - teams1.OwnedRunbooks = append(teams1.OwnedRunbooks, ownedRunbooks1) - } else { - teams1.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - teams1.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - teams1.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - teams1.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - teams1.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - teams1.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - teams1.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - teams1.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - teams1.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - teams1.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - teams1.SignalsIcalURL = types.StringPointerValue(teamsItem.SignalsIcalURL) - if teamsItem.SlackChannel == nil { - teams1.SlackChannel = nil - } else { - teams1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams1.SlackChannel.ID = types.StringPointerValue(teamsItem.SlackChannel.ID) - teams1.SlackChannel.Name = types.StringPointerValue(teamsItem.SlackChannel.Name) - teams1.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem.SlackChannel.SlackChannelID) - } - teams1.Slug = types.StringPointerValue(teamsItem.Slug) - if teamsItem.UpdatedAt != nil { - teams1.UpdatedAt = types.StringValue(teamsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams1.UpdatedAt = types.StringNull() - } - if teamsCount+1 > len(r.TemplateValues.Teams) { - r.TemplateValues.Teams = append(r.TemplateValues.Teams, teams1) - } else { - r.TemplateValues.Teams[teamsCount].CreatedAt = teams1.CreatedAt - r.TemplateValues.Teams[teamsCount].CreatedBy = teams1.CreatedBy - r.TemplateValues.Teams[teamsCount].Description = teams1.Description - r.TemplateValues.Teams[teamsCount].Functionalities = teams1.Functionalities - r.TemplateValues.Teams[teamsCount].ID = teams1.ID - r.TemplateValues.Teams[teamsCount].Memberships = teams1.Memberships - r.TemplateValues.Teams[teamsCount].MsTeamsChannel = teams1.MsTeamsChannel - r.TemplateValues.Teams[teamsCount].Name = teams1.Name - r.TemplateValues.Teams[teamsCount].OwnedFunctionalities = teams1.OwnedFunctionalities - r.TemplateValues.Teams[teamsCount].OwnedRunbooks = teams1.OwnedRunbooks - r.TemplateValues.Teams[teamsCount].SignalsIcalURL = teams1.SignalsIcalURL - r.TemplateValues.Teams[teamsCount].SlackChannel = teams1.SlackChannel - r.TemplateValues.Teams[teamsCount].Slug = teams1.Slug - r.TemplateValues.Teams[teamsCount].UpdatedAt = teams1.UpdatedAt - } - } - } - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} diff --git a/internal/provider/incidenttype_resource.go b/internal/provider/incidenttype_resource.go deleted file mode 100644 index ff63371..0000000 --- a/internal/provider/incidenttype_resource.go +++ /dev/null @@ -1,996 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - speakeasy_objectvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/objectvalidators" - speakeasy_stringvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/stringvalidators" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &IncidentTypeResource{} -var _ resource.ResourceWithImportState = &IncidentTypeResource{} - -func NewIncidentTypeResource() resource.Resource { - return &IncidentTypeResource{} -} - -// IncidentTypeResource defines the resource implementation. -type IncidentTypeResource struct { - client *sdk.Firehydrant -} - -// IncidentTypeResourceModel describes the resource data model. -type IncidentTypeResourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Template tfTypes.Template `tfsdk:"template"` - TemplateValues *tfTypes.IncidentTypeEntityTemplateValuesEntity `tfsdk:"template_values"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *IncidentTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_incident_type" -} - -func (r *IncidentTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "IncidentType Resource", - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "template": schema.SingleNestedAttribute{ - Required: true, - Attributes: map[string]schema.Attribute{ - "custom_fields": schema.StringAttribute{ - Computed: true, - }, - "customer_impact_summary": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "impacts": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `The id of the condition. Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `The id of impact. Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["environment", "functionality", "service"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "environment", - "functionality", - "service", - ), - }, - }, - }, - }, - Description: `An array of impact/condition combinations`, - }, - "incident_name": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Description: `A labels hash of keys and values`, - }, - "priority": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "private_incident": schema.BoolAttribute{ - Computed: true, - Optional: true, - }, - "runbook_ids": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Description: `List of ids of Runbooks to attach to incidents created from this type`, - }, - "severity": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "tag_list": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Description: `List of tags for the incident`, - }, - "team_ids": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Description: `List of ids of teams to be assigned to incidents`, - }, - }, - }, - "template_values": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "environments": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["environment", "functionality", "service"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "environment", - "functionality", - "service", - ), - }, - }, - }, - }, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["environment", "functionality", "service"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "environment", - "functionality", - "service", - ), - }, - }, - }, - }, - }, - "runbooks": schema.SingleNestedAttribute{ - Computed: true, - Description: `A hash mapping runbook IDs to runbook names.`, - }, - "services": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["environment", "functionality", "service"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "environment", - "functionality", - "service", - ), - }, - }, - }, - }, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *IncidentTypeResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *IncidentTypeResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *IncidentTypeResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1IncidentTypes() - res, err := r.client.IncidentTypes.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.IncidentTypeEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedIncidentTypeEntity(res.IncidentTypeEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *IncidentTypeResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *IncidentTypeResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - request := operations.GetV1IncidentTypesIDRequest{ - ID: id, - } - res, err := r.client.IncidentTypes.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.IncidentTypeEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedIncidentTypeEntity(res.IncidentTypeEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *IncidentTypeResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *IncidentTypeResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - patchV1IncidentTypesID := *data.ToSharedPatchV1IncidentTypesID() - request := operations.PatchV1IncidentTypesIDRequest{ - ID: id, - PatchV1IncidentTypesID: patchV1IncidentTypesID, - } - res, err := r.client.IncidentTypes.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.IncidentTypeEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedIncidentTypeEntity(res.IncidentTypeEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *IncidentTypeResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *IncidentTypeResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - request := operations.DeleteV1IncidentTypesIDRequest{ - ID: id, - } - res, err := r.client.IncidentTypes.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *IncidentTypeResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/incidenttype_resource_sdk.go b/internal/provider/incidenttype_resource_sdk.go deleted file mode 100644 index 9cb4b10..0000000 --- a/internal/provider/incidenttype_resource_sdk.go +++ /dev/null @@ -1,749 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *IncidentTypeResourceModel) ToSharedPostV1IncidentTypes() *shared.PostV1IncidentTypes { - var name string - name = r.Name.ValueString() - - description := new(string) - if !r.Template.Description.IsUnknown() && !r.Template.Description.IsNull() { - *description = r.Template.Description.ValueString() - } else { - description = nil - } - customerImpactSummary := new(string) - if !r.Template.CustomerImpactSummary.IsUnknown() && !r.Template.CustomerImpactSummary.IsNull() { - *customerImpactSummary = r.Template.CustomerImpactSummary.ValueString() - } else { - customerImpactSummary = nil - } - labels := make(map[string]string) - for labelsKey, labelsValue := range r.Template.Labels { - var labelsInst string - labelsInst = labelsValue.ValueString() - - labels[labelsKey] = labelsInst - } - severity := new(string) - if !r.Template.Severity.IsUnknown() && !r.Template.Severity.IsNull() { - *severity = r.Template.Severity.ValueString() - } else { - severity = nil - } - priority := new(string) - if !r.Template.Priority.IsUnknown() && !r.Template.Priority.IsNull() { - *priority = r.Template.Priority.ValueString() - } else { - priority = nil - } - var tagList []string = []string{} - for _, tagListItem := range r.Template.TagList { - tagList = append(tagList, tagListItem.ValueString()) - } - var runbookIds []string = []string{} - for _, runbookIdsItem := range r.Template.RunbookIds { - runbookIds = append(runbookIds, runbookIdsItem.ValueString()) - } - privateIncident := new(bool) - if !r.Template.PrivateIncident.IsUnknown() && !r.Template.PrivateIncident.IsNull() { - *privateIncident = r.Template.PrivateIncident.ValueBool() - } else { - privateIncident = nil - } - var teamIds []string = []string{} - for _, teamIdsItem := range r.Template.TeamIds { - teamIds = append(teamIds, teamIdsItem.ValueString()) - } - var impacts []shared.PostV1IncidentTypesImpacts = []shared.PostV1IncidentTypesImpacts{} - for _, impactsItem := range r.Template.Impacts { - var id string - id = impactsItem.ID.ValueString() - - var conditionID string - conditionID = impactsItem.ConditionID.ValueString() - - impacts = append(impacts, shared.PostV1IncidentTypesImpacts{ - ID: id, - ConditionID: conditionID, - }) - } - template := shared.Template{ - Description: description, - CustomerImpactSummary: customerImpactSummary, - Labels: labels, - Severity: severity, - Priority: priority, - TagList: tagList, - RunbookIds: runbookIds, - PrivateIncident: privateIncident, - TeamIds: teamIds, - Impacts: impacts, - } - out := shared.PostV1IncidentTypes{ - Name: name, - Template: template, - } - return &out -} - -func (r *IncidentTypeResourceModel) RefreshFromSharedIncidentTypeEntity(resp *shared.IncidentTypeEntity) { - if resp != nil { - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.ID = types.StringPointerValue(resp.ID) - r.Name = types.StringPointerValue(resp.Name) - if resp.Template != nil { - r.Template.CustomFields = types.StringPointerValue(resp.Template.CustomFields) - r.Template.CustomerImpactSummary = types.StringPointerValue(resp.Template.CustomerImpactSummary) - r.Template.Description = types.StringPointerValue(resp.Template.Description) - r.Template.Impacts = []tfTypes.PostV1IncidentTypesImpacts{} - if len(r.Template.Impacts) > len(resp.Template.Impacts) { - r.Template.Impacts = r.Template.Impacts[:len(resp.Template.Impacts)] - } - for impactsCount, impactsItem := range resp.Template.Impacts { - var impacts1 tfTypes.PostV1IncidentTypesImpacts - impacts1.ConditionID = types.StringPointerValue(impactsItem.ConditionID) - impacts1.ConditionName = types.StringPointerValue(impactsItem.ConditionName) - impacts1.ID = types.StringPointerValue(impactsItem.ID) - impacts1.Name = types.StringPointerValue(impactsItem.Name) - if impactsItem.Type != nil { - impacts1.Type = types.StringValue(string(*impactsItem.Type)) - } else { - impacts1.Type = types.StringNull() - } - if impactsCount+1 > len(r.Template.Impacts) { - r.Template.Impacts = append(r.Template.Impacts, impacts1) - } else { - r.Template.Impacts[impactsCount].ConditionID = impacts1.ConditionID - r.Template.Impacts[impactsCount].ConditionName = impacts1.ConditionName - r.Template.Impacts[impactsCount].ID = impacts1.ID - r.Template.Impacts[impactsCount].Name = impacts1.Name - r.Template.Impacts[impactsCount].Type = impacts1.Type - } - } - r.Template.IncidentName = types.StringPointerValue(resp.Template.IncidentName) - if len(resp.Template.Labels) > 0 { - r.Template.Labels = make(map[string]types.String) - for key, value := range resp.Template.Labels { - r.Template.Labels[key] = types.StringValue(value) - } - } - r.Template.Priority = types.StringPointerValue(resp.Template.Priority) - r.Template.PrivateIncident = types.BoolPointerValue(resp.Template.PrivateIncident) - r.Template.RunbookIds = []types.String{} - for _, v := range resp.Template.RunbookIds { - r.Template.RunbookIds = append(r.Template.RunbookIds, types.StringValue(v)) - } - r.Template.Severity = types.StringPointerValue(resp.Template.Severity) - r.Template.Summary = types.StringPointerValue(resp.Template.Summary) - r.Template.TagList = []types.String{} - for _, v := range resp.Template.TagList { - r.Template.TagList = append(r.Template.TagList, types.StringValue(v)) - } - r.Template.TeamIds = []types.String{} - for _, v := range resp.Template.TeamIds { - r.Template.TeamIds = append(r.Template.TeamIds, types.StringValue(v)) - } - } - if resp.TemplateValues == nil { - r.TemplateValues = nil - } else { - r.TemplateValues = &tfTypes.IncidentTypeEntityTemplateValuesEntity{} - r.TemplateValues.Environments = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - if len(r.TemplateValues.Environments) > len(resp.TemplateValues.Environments) { - r.TemplateValues.Environments = r.TemplateValues.Environments[:len(resp.TemplateValues.Environments)] - } - for environmentsCount, environmentsItem := range resp.TemplateValues.Environments { - var environments1 tfTypes.IncidentTypeEntityTemplateImpactEntity - environments1.ConditionID = types.StringPointerValue(environmentsItem.ConditionID) - environments1.ConditionName = types.StringPointerValue(environmentsItem.ConditionName) - environments1.ID = types.StringPointerValue(environmentsItem.ID) - environments1.Name = types.StringPointerValue(environmentsItem.Name) - if environmentsItem.Type != nil { - environments1.Type = types.StringValue(string(*environmentsItem.Type)) - } else { - environments1.Type = types.StringNull() - } - if environmentsCount+1 > len(r.TemplateValues.Environments) { - r.TemplateValues.Environments = append(r.TemplateValues.Environments, environments1) - } else { - r.TemplateValues.Environments[environmentsCount].ConditionID = environments1.ConditionID - r.TemplateValues.Environments[environmentsCount].ConditionName = environments1.ConditionName - r.TemplateValues.Environments[environmentsCount].ID = environments1.ID - r.TemplateValues.Environments[environmentsCount].Name = environments1.Name - r.TemplateValues.Environments[environmentsCount].Type = environments1.Type - } - } - r.TemplateValues.Functionalities = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - if len(r.TemplateValues.Functionalities) > len(resp.TemplateValues.Functionalities) { - r.TemplateValues.Functionalities = r.TemplateValues.Functionalities[:len(resp.TemplateValues.Functionalities)] - } - for functionalitiesCount, functionalitiesItem := range resp.TemplateValues.Functionalities { - var functionalities1 tfTypes.IncidentTypeEntityTemplateImpactEntity - functionalities1.ConditionID = types.StringPointerValue(functionalitiesItem.ConditionID) - functionalities1.ConditionName = types.StringPointerValue(functionalitiesItem.ConditionName) - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Type != nil { - functionalities1.Type = types.StringValue(string(*functionalitiesItem.Type)) - } else { - functionalities1.Type = types.StringNull() - } - if functionalitiesCount+1 > len(r.TemplateValues.Functionalities) { - r.TemplateValues.Functionalities = append(r.TemplateValues.Functionalities, functionalities1) - } else { - r.TemplateValues.Functionalities[functionalitiesCount].ConditionID = functionalities1.ConditionID - r.TemplateValues.Functionalities[functionalitiesCount].ConditionName = functionalities1.ConditionName - r.TemplateValues.Functionalities[functionalitiesCount].ID = functionalities1.ID - r.TemplateValues.Functionalities[functionalitiesCount].Name = functionalities1.Name - r.TemplateValues.Functionalities[functionalitiesCount].Type = functionalities1.Type - } - } - if resp.TemplateValues.Runbooks == nil { - r.TemplateValues.Runbooks = nil - } else { - r.TemplateValues.Runbooks = &tfTypes.TeamEntity1{} - } - r.TemplateValues.Services = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - if len(r.TemplateValues.Services) > len(resp.TemplateValues.Services) { - r.TemplateValues.Services = r.TemplateValues.Services[:len(resp.TemplateValues.Services)] - } - for servicesCount, servicesItem := range resp.TemplateValues.Services { - var services1 tfTypes.IncidentTypeEntityTemplateImpactEntity - services1.ConditionID = types.StringPointerValue(servicesItem.ConditionID) - services1.ConditionName = types.StringPointerValue(servicesItem.ConditionName) - services1.ID = types.StringPointerValue(servicesItem.ID) - services1.Name = types.StringPointerValue(servicesItem.Name) - if servicesItem.Type != nil { - services1.Type = types.StringValue(string(*servicesItem.Type)) - } else { - services1.Type = types.StringNull() - } - if servicesCount+1 > len(r.TemplateValues.Services) { - r.TemplateValues.Services = append(r.TemplateValues.Services, services1) - } else { - r.TemplateValues.Services[servicesCount].ConditionID = services1.ConditionID - r.TemplateValues.Services[servicesCount].ConditionName = services1.ConditionName - r.TemplateValues.Services[servicesCount].ID = services1.ID - r.TemplateValues.Services[servicesCount].Name = services1.Name - r.TemplateValues.Services[servicesCount].Type = services1.Type - } - } - r.TemplateValues.Teams = []tfTypes.TeamEntity{} - if len(r.TemplateValues.Teams) > len(resp.TemplateValues.Teams) { - r.TemplateValues.Teams = r.TemplateValues.Teams[:len(resp.TemplateValues.Teams)] - } - for teamsCount, teamsItem := range resp.TemplateValues.Teams { - var teams1 tfTypes.TeamEntity - if teamsItem.CreatedAt != nil { - teams1.CreatedAt = types.StringValue(teamsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams1.CreatedAt = types.StringNull() - } - if teamsItem.CreatedBy == nil { - teams1.CreatedBy = nil - } else { - teams1.CreatedBy = &tfTypes.AuthorEntity{} - teams1.CreatedBy.Email = types.StringPointerValue(teamsItem.CreatedBy.Email) - teams1.CreatedBy.ID = types.StringPointerValue(teamsItem.CreatedBy.ID) - teams1.CreatedBy.Name = types.StringPointerValue(teamsItem.CreatedBy.Name) - teams1.CreatedBy.Source = types.StringPointerValue(teamsItem.CreatedBy.Source) - } - teams1.Description = types.StringPointerValue(teamsItem.Description) - teams1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount1, functionalitiesItem1 := range teamsItem.Functionalities { - var functionalities3 tfTypes.FunctionalityEntity - functionalities3.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem1.ActiveIncidents { - functionalities3.ActiveIncidents = append(functionalities3.ActiveIncidents, types.StringValue(v)) - } - functionalities3.AlertOnAdd = types.BoolPointerValue(functionalitiesItem1.AlertOnAdd) - functionalities3.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem1.AutoAddRespondingTeam) - if functionalitiesItem1.CreatedAt != nil { - functionalities3.CreatedAt = types.StringValue(functionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.CreatedAt = types.StringNull() - } - functionalities3.Description = types.StringPointerValue(functionalitiesItem1.Description) - functionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem1.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities3.ExternalResources) { - functionalities3.ExternalResources = append(functionalities3.ExternalResources, externalResources1) - } else { - functionalities3.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities3.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities3.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities3.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities3.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities3.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities3.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities3.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities3.ID = types.StringPointerValue(functionalitiesItem1.ID) - if len(functionalitiesItem1.Labels) > 0 { - functionalities3.Labels = make(map[string]types.String) - for key1, value1 := range functionalitiesItem1.Labels { - functionalities3.Labels[key1] = types.StringValue(value1) - } - } - functionalities3.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem1.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities3.Links) { - functionalities3.Links = append(functionalities3.Links, links1) - } else { - functionalities3.Links[linksCount].HrefURL = links1.HrefURL - functionalities3.Links[linksCount].IconURL = links1.IconURL - functionalities3.Links[linksCount].ID = links1.ID - functionalities3.Links[linksCount].Name = links1.Name - } - } - functionalities3.Name = types.StringPointerValue(functionalitiesItem1.Name) - if functionalitiesItem1.Owner == nil { - functionalities3.Owner = nil - } else { - functionalities3.Owner = &tfTypes.TeamEntity1{} - } - functionalities3.Slug = types.StringPointerValue(functionalitiesItem1.Slug) - if functionalitiesItem1.UpdatedAt != nil { - functionalities3.UpdatedAt = types.StringValue(functionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.UpdatedAt = types.StringNull() - } - if functionalitiesItem1.UpdatedBy == nil { - functionalities3.UpdatedBy = nil - } else { - functionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities3.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Email) - functionalities3.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem1.UpdatedBy.ID) - functionalities3.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Name) - functionalities3.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Source) - } - if functionalitiesCount1+1 > len(teams1.Functionalities) { - teams1.Functionalities = append(teams1.Functionalities, functionalities3) - } else { - teams1.Functionalities[functionalitiesCount1].ActiveIncidents = functionalities3.ActiveIncidents - teams1.Functionalities[functionalitiesCount1].AlertOnAdd = functionalities3.AlertOnAdd - teams1.Functionalities[functionalitiesCount1].AutoAddRespondingTeam = functionalities3.AutoAddRespondingTeam - teams1.Functionalities[functionalitiesCount1].CreatedAt = functionalities3.CreatedAt - teams1.Functionalities[functionalitiesCount1].Description = functionalities3.Description - teams1.Functionalities[functionalitiesCount1].ExternalResources = functionalities3.ExternalResources - teams1.Functionalities[functionalitiesCount1].ID = functionalities3.ID - teams1.Functionalities[functionalitiesCount1].Labels = functionalities3.Labels - teams1.Functionalities[functionalitiesCount1].Links = functionalities3.Links - teams1.Functionalities[functionalitiesCount1].Name = functionalities3.Name - teams1.Functionalities[functionalitiesCount1].Owner = functionalities3.Owner - teams1.Functionalities[functionalitiesCount1].Slug = functionalities3.Slug - teams1.Functionalities[functionalitiesCount1].UpdatedAt = functionalities3.UpdatedAt - teams1.Functionalities[functionalitiesCount1].UpdatedBy = functionalities3.UpdatedBy - } - } - teams1.ID = types.StringPointerValue(teamsItem.ID) - teams1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range teamsItem.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(teams1.Memberships) { - teams1.Memberships = append(teams1.Memberships, memberships1) - } else { - teams1.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - teams1.Memberships[membershipsCount].Schedule = memberships1.Schedule - teams1.Memberships[membershipsCount].User = memberships1.User - } - } - if teamsItem.MsTeamsChannel == nil { - teams1.MsTeamsChannel = nil - } else { - teams1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams1.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelID) - teams1.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelName) - teams1.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelURL) - teams1.MsTeamsChannel.ID = types.StringPointerValue(teamsItem.MsTeamsChannel.ID) - teams1.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem.MsTeamsChannel.MsTeamID) - teams1.MsTeamsChannel.Status = types.StringPointerValue(teamsItem.MsTeamsChannel.Status) - teams1.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem.MsTeamsChannel.TeamName) - } - teams1.Name = types.StringPointerValue(teamsItem.Name) - teams1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range teamsItem.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key2, value2 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key2] = types.StringValue(value2) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(teams1.OwnedFunctionalities) { - teams1.OwnedFunctionalities = append(teams1.OwnedFunctionalities, ownedFunctionalities1) - } else { - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - teams1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range teamsItem.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(teams1.OwnedRunbooks) { - teams1.OwnedRunbooks = append(teams1.OwnedRunbooks, ownedRunbooks1) - } else { - teams1.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - teams1.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - teams1.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - teams1.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - teams1.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - teams1.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - teams1.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - teams1.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - teams1.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - teams1.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - teams1.SignalsIcalURL = types.StringPointerValue(teamsItem.SignalsIcalURL) - if teamsItem.SlackChannel == nil { - teams1.SlackChannel = nil - } else { - teams1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams1.SlackChannel.ID = types.StringPointerValue(teamsItem.SlackChannel.ID) - teams1.SlackChannel.Name = types.StringPointerValue(teamsItem.SlackChannel.Name) - teams1.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem.SlackChannel.SlackChannelID) - } - teams1.Slug = types.StringPointerValue(teamsItem.Slug) - if teamsItem.UpdatedAt != nil { - teams1.UpdatedAt = types.StringValue(teamsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams1.UpdatedAt = types.StringNull() - } - if teamsCount+1 > len(r.TemplateValues.Teams) { - r.TemplateValues.Teams = append(r.TemplateValues.Teams, teams1) - } else { - r.TemplateValues.Teams[teamsCount].CreatedAt = teams1.CreatedAt - r.TemplateValues.Teams[teamsCount].CreatedBy = teams1.CreatedBy - r.TemplateValues.Teams[teamsCount].Description = teams1.Description - r.TemplateValues.Teams[teamsCount].Functionalities = teams1.Functionalities - r.TemplateValues.Teams[teamsCount].ID = teams1.ID - r.TemplateValues.Teams[teamsCount].Memberships = teams1.Memberships - r.TemplateValues.Teams[teamsCount].MsTeamsChannel = teams1.MsTeamsChannel - r.TemplateValues.Teams[teamsCount].Name = teams1.Name - r.TemplateValues.Teams[teamsCount].OwnedFunctionalities = teams1.OwnedFunctionalities - r.TemplateValues.Teams[teamsCount].OwnedRunbooks = teams1.OwnedRunbooks - r.TemplateValues.Teams[teamsCount].SignalsIcalURL = teams1.SignalsIcalURL - r.TemplateValues.Teams[teamsCount].SlackChannel = teams1.SlackChannel - r.TemplateValues.Teams[teamsCount].Slug = teams1.Slug - r.TemplateValues.Teams[teamsCount].UpdatedAt = teams1.UpdatedAt - } - } - } - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} - -func (r *IncidentTypeResourceModel) ToSharedPatchV1IncidentTypesID() *shared.PatchV1IncidentTypesID { - var name string - name = r.Name.ValueString() - - description := new(string) - if !r.Template.Description.IsUnknown() && !r.Template.Description.IsNull() { - *description = r.Template.Description.ValueString() - } else { - description = nil - } - customerImpactSummary := new(string) - if !r.Template.CustomerImpactSummary.IsUnknown() && !r.Template.CustomerImpactSummary.IsNull() { - *customerImpactSummary = r.Template.CustomerImpactSummary.ValueString() - } else { - customerImpactSummary = nil - } - labels := make(map[string]string) - for labelsKey, labelsValue := range r.Template.Labels { - var labelsInst string - labelsInst = labelsValue.ValueString() - - labels[labelsKey] = labelsInst - } - severity := new(string) - if !r.Template.Severity.IsUnknown() && !r.Template.Severity.IsNull() { - *severity = r.Template.Severity.ValueString() - } else { - severity = nil - } - priority := new(string) - if !r.Template.Priority.IsUnknown() && !r.Template.Priority.IsNull() { - *priority = r.Template.Priority.ValueString() - } else { - priority = nil - } - var tagList []string = []string{} - for _, tagListItem := range r.Template.TagList { - tagList = append(tagList, tagListItem.ValueString()) - } - var runbookIds []string = []string{} - for _, runbookIdsItem := range r.Template.RunbookIds { - runbookIds = append(runbookIds, runbookIdsItem.ValueString()) - } - privateIncident := new(bool) - if !r.Template.PrivateIncident.IsUnknown() && !r.Template.PrivateIncident.IsNull() { - *privateIncident = r.Template.PrivateIncident.ValueBool() - } else { - privateIncident = nil - } - var teamIds []string = []string{} - for _, teamIdsItem := range r.Template.TeamIds { - teamIds = append(teamIds, teamIdsItem.ValueString()) - } - var impacts []shared.PatchV1IncidentTypesIDImpacts = []shared.PatchV1IncidentTypesIDImpacts{} - for _, impactsItem := range r.Template.Impacts { - var id string - id = impactsItem.ID.ValueString() - - var conditionID string - conditionID = impactsItem.ConditionID.ValueString() - - impacts = append(impacts, shared.PatchV1IncidentTypesIDImpacts{ - ID: id, - ConditionID: conditionID, - }) - } - template := shared.PatchV1IncidentTypesIDTemplate{ - Description: description, - CustomerImpactSummary: customerImpactSummary, - Labels: labels, - Severity: severity, - Priority: priority, - TagList: tagList, - RunbookIds: runbookIds, - PrivateIncident: privateIncident, - TeamIds: teamIds, - Impacts: impacts, - } - out := shared.PatchV1IncidentTypesID{ - Name: name, - Template: template, - } - return &out -} diff --git a/internal/provider/incidenttypes_data_source.go b/internal/provider/incidenttypes_data_source.go deleted file mode 100644 index ac49e0c..0000000 --- a/internal/provider/incidenttypes_data_source.go +++ /dev/null @@ -1,794 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &IncidentTypesDataSource{} -var _ datasource.DataSourceWithConfigure = &IncidentTypesDataSource{} - -func NewIncidentTypesDataSource() datasource.DataSource { - return &IncidentTypesDataSource{} -} - -// IncidentTypesDataSource is the data source implementation. -type IncidentTypesDataSource struct { - client *sdk.Firehydrant -} - -// IncidentTypesDataSourceModel describes the data model. -type IncidentTypesDataSourceModel struct { - Data []tfTypes.IncidentTypeEntity `tfsdk:"data"` - Page types.Int64 `tfsdk:"page"` - Pagination *tfTypes.PaginationEntity `tfsdk:"pagination"` - PerPage types.Int64 `tfsdk:"per_page"` - Query types.String `tfsdk:"query"` -} - -// Metadata returns the data source type name. -func (r *IncidentTypesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_incident_types" -} - -// Schema defines the schema for the data source. -func (r *IncidentTypesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "IncidentTypes DataSource", - - Attributes: map[string]schema.Attribute{ - "data": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "template": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "custom_fields": schema.StringAttribute{ - Computed: true, - }, - "customer_impact_summary": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "impacts": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "incident_name": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `Arbitrary key:value pairs of labels for your incidents.`, - }, - "priority": schema.StringAttribute{ - Computed: true, - }, - "private_incident": schema.BoolAttribute{ - Computed: true, - }, - "runbook_ids": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "severity": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "tag_list": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "team_ids": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - }, - }, - "template_values": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "environments": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "runbooks": schema.SingleNestedAttribute{ - Computed: true, - Description: `A hash mapping runbook IDs to runbook names.`, - }, - "services": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "condition_id": schema.StringAttribute{ - Computed: true, - }, - "condition_name": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "pagination": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "count": schema.Int64Attribute{ - Computed: true, - }, - "items": schema.Int64Attribute{ - Computed: true, - }, - "last": schema.Int64Attribute{ - Computed: true, - }, - "next": schema.Int64Attribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Computed: true, - }, - "pages": schema.Int64Attribute{ - Computed: true, - }, - "prev": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "query": schema.StringAttribute{ - Optional: true, - Description: `A query to search incident types by their name`, - }, - }, - } -} - -func (r *IncidentTypesDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *IncidentTypesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *IncidentTypesDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - query := new(string) - if !data.Query.IsUnknown() && !data.Query.IsNull() { - *query = data.Query.ValueString() - } else { - query = nil - } - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - request := operations.GetV1IncidentTypesRequest{ - Query: query, - Page: page, - PerPage: perPage, - } - res, err := r.client.IncidentTypes.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.IncidentTypeEntityPaginated != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedIncidentTypeEntityPaginated(res.IncidentTypeEntityPaginated) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/incidenttypes_data_source_sdk.go b/internal/provider/incidenttypes_data_source_sdk.go deleted file mode 100644 index 48479cb..0000000 --- a/internal/provider/incidenttypes_data_source_sdk.go +++ /dev/null @@ -1,624 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *IncidentTypesDataSourceModel) RefreshFromSharedIncidentTypeEntityPaginated(resp *shared.IncidentTypeEntityPaginated) { - if resp != nil { - r.Data = []tfTypes.IncidentTypeEntity{} - if len(r.Data) > len(resp.Data) { - r.Data = r.Data[:len(resp.Data)] - } - for dataCount, dataItem := range resp.Data { - var data1 tfTypes.IncidentTypeEntity - if dataItem.CreatedAt != nil { - data1.CreatedAt = types.StringValue(dataItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.CreatedAt = types.StringNull() - } - data1.ID = types.StringPointerValue(dataItem.ID) - data1.Name = types.StringPointerValue(dataItem.Name) - if dataItem.Template == nil { - data1.Template = nil - } else { - data1.Template = &tfTypes.IncidentTypeEntityTemplateEntity{} - data1.Template.CustomFields = types.StringPointerValue(dataItem.Template.CustomFields) - data1.Template.CustomerImpactSummary = types.StringPointerValue(dataItem.Template.CustomerImpactSummary) - data1.Template.Description = types.StringPointerValue(dataItem.Template.Description) - data1.Template.Impacts = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - for impactsCount, impactsItem := range dataItem.Template.Impacts { - var impacts1 tfTypes.IncidentTypeEntityTemplateImpactEntity - impacts1.ConditionID = types.StringPointerValue(impactsItem.ConditionID) - impacts1.ConditionName = types.StringPointerValue(impactsItem.ConditionName) - impacts1.ID = types.StringPointerValue(impactsItem.ID) - impacts1.Name = types.StringPointerValue(impactsItem.Name) - if impactsItem.Type != nil { - impacts1.Type = types.StringValue(string(*impactsItem.Type)) - } else { - impacts1.Type = types.StringNull() - } - if impactsCount+1 > len(data1.Template.Impacts) { - data1.Template.Impacts = append(data1.Template.Impacts, impacts1) - } else { - data1.Template.Impacts[impactsCount].ConditionID = impacts1.ConditionID - data1.Template.Impacts[impactsCount].ConditionName = impacts1.ConditionName - data1.Template.Impacts[impactsCount].ID = impacts1.ID - data1.Template.Impacts[impactsCount].Name = impacts1.Name - data1.Template.Impacts[impactsCount].Type = impacts1.Type - } - } - data1.Template.IncidentName = types.StringPointerValue(dataItem.Template.IncidentName) - if len(dataItem.Template.Labels) > 0 { - data1.Template.Labels = make(map[string]types.String) - for key, value := range dataItem.Template.Labels { - data1.Template.Labels[key] = types.StringValue(value) - } - } - data1.Template.Priority = types.StringPointerValue(dataItem.Template.Priority) - data1.Template.PrivateIncident = types.BoolPointerValue(dataItem.Template.PrivateIncident) - data1.Template.RunbookIds = []types.String{} - for _, v := range dataItem.Template.RunbookIds { - data1.Template.RunbookIds = append(data1.Template.RunbookIds, types.StringValue(v)) - } - data1.Template.Severity = types.StringPointerValue(dataItem.Template.Severity) - data1.Template.Summary = types.StringPointerValue(dataItem.Template.Summary) - data1.Template.TagList = []types.String{} - for _, v := range dataItem.Template.TagList { - data1.Template.TagList = append(data1.Template.TagList, types.StringValue(v)) - } - data1.Template.TeamIds = []types.String{} - for _, v := range dataItem.Template.TeamIds { - data1.Template.TeamIds = append(data1.Template.TeamIds, types.StringValue(v)) - } - } - if dataItem.TemplateValues == nil { - data1.TemplateValues = nil - } else { - data1.TemplateValues = &tfTypes.IncidentTypeEntityTemplateValuesEntity{} - data1.TemplateValues.Environments = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - for environmentsCount, environmentsItem := range dataItem.TemplateValues.Environments { - var environments1 tfTypes.IncidentTypeEntityTemplateImpactEntity - environments1.ConditionID = types.StringPointerValue(environmentsItem.ConditionID) - environments1.ConditionName = types.StringPointerValue(environmentsItem.ConditionName) - environments1.ID = types.StringPointerValue(environmentsItem.ID) - environments1.Name = types.StringPointerValue(environmentsItem.Name) - if environmentsItem.Type != nil { - environments1.Type = types.StringValue(string(*environmentsItem.Type)) - } else { - environments1.Type = types.StringNull() - } - if environmentsCount+1 > len(data1.TemplateValues.Environments) { - data1.TemplateValues.Environments = append(data1.TemplateValues.Environments, environments1) - } else { - data1.TemplateValues.Environments[environmentsCount].ConditionID = environments1.ConditionID - data1.TemplateValues.Environments[environmentsCount].ConditionName = environments1.ConditionName - data1.TemplateValues.Environments[environmentsCount].ID = environments1.ID - data1.TemplateValues.Environments[environmentsCount].Name = environments1.Name - data1.TemplateValues.Environments[environmentsCount].Type = environments1.Type - } - } - data1.TemplateValues.Functionalities = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - for functionalitiesCount, functionalitiesItem := range dataItem.TemplateValues.Functionalities { - var functionalities1 tfTypes.IncidentTypeEntityTemplateImpactEntity - functionalities1.ConditionID = types.StringPointerValue(functionalitiesItem.ConditionID) - functionalities1.ConditionName = types.StringPointerValue(functionalitiesItem.ConditionName) - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Type != nil { - functionalities1.Type = types.StringValue(string(*functionalitiesItem.Type)) - } else { - functionalities1.Type = types.StringNull() - } - if functionalitiesCount+1 > len(data1.TemplateValues.Functionalities) { - data1.TemplateValues.Functionalities = append(data1.TemplateValues.Functionalities, functionalities1) - } else { - data1.TemplateValues.Functionalities[functionalitiesCount].ConditionID = functionalities1.ConditionID - data1.TemplateValues.Functionalities[functionalitiesCount].ConditionName = functionalities1.ConditionName - data1.TemplateValues.Functionalities[functionalitiesCount].ID = functionalities1.ID - data1.TemplateValues.Functionalities[functionalitiesCount].Name = functionalities1.Name - data1.TemplateValues.Functionalities[functionalitiesCount].Type = functionalities1.Type - } - } - if dataItem.TemplateValues.Runbooks == nil { - data1.TemplateValues.Runbooks = nil - } else { - data1.TemplateValues.Runbooks = &tfTypes.TeamEntity1{} - } - data1.TemplateValues.Services = []tfTypes.IncidentTypeEntityTemplateImpactEntity{} - for servicesCount, servicesItem := range dataItem.TemplateValues.Services { - var services1 tfTypes.IncidentTypeEntityTemplateImpactEntity - services1.ConditionID = types.StringPointerValue(servicesItem.ConditionID) - services1.ConditionName = types.StringPointerValue(servicesItem.ConditionName) - services1.ID = types.StringPointerValue(servicesItem.ID) - services1.Name = types.StringPointerValue(servicesItem.Name) - if servicesItem.Type != nil { - services1.Type = types.StringValue(string(*servicesItem.Type)) - } else { - services1.Type = types.StringNull() - } - if servicesCount+1 > len(data1.TemplateValues.Services) { - data1.TemplateValues.Services = append(data1.TemplateValues.Services, services1) - } else { - data1.TemplateValues.Services[servicesCount].ConditionID = services1.ConditionID - data1.TemplateValues.Services[servicesCount].ConditionName = services1.ConditionName - data1.TemplateValues.Services[servicesCount].ID = services1.ID - data1.TemplateValues.Services[servicesCount].Name = services1.Name - data1.TemplateValues.Services[servicesCount].Type = services1.Type - } - } - data1.TemplateValues.Teams = []tfTypes.TeamEntity{} - for teamsCount, teamsItem := range dataItem.TemplateValues.Teams { - var teams1 tfTypes.TeamEntity - if teamsItem.CreatedAt != nil { - teams1.CreatedAt = types.StringValue(teamsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams1.CreatedAt = types.StringNull() - } - if teamsItem.CreatedBy == nil { - teams1.CreatedBy = nil - } else { - teams1.CreatedBy = &tfTypes.AuthorEntity{} - teams1.CreatedBy.Email = types.StringPointerValue(teamsItem.CreatedBy.Email) - teams1.CreatedBy.ID = types.StringPointerValue(teamsItem.CreatedBy.ID) - teams1.CreatedBy.Name = types.StringPointerValue(teamsItem.CreatedBy.Name) - teams1.CreatedBy.Source = types.StringPointerValue(teamsItem.CreatedBy.Source) - } - teams1.Description = types.StringPointerValue(teamsItem.Description) - teams1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount1, functionalitiesItem1 := range teamsItem.Functionalities { - var functionalities3 tfTypes.FunctionalityEntity - functionalities3.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem1.ActiveIncidents { - functionalities3.ActiveIncidents = append(functionalities3.ActiveIncidents, types.StringValue(v)) - } - functionalities3.AlertOnAdd = types.BoolPointerValue(functionalitiesItem1.AlertOnAdd) - functionalities3.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem1.AutoAddRespondingTeam) - if functionalitiesItem1.CreatedAt != nil { - functionalities3.CreatedAt = types.StringValue(functionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.CreatedAt = types.StringNull() - } - functionalities3.Description = types.StringPointerValue(functionalitiesItem1.Description) - functionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem1.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities3.ExternalResources) { - functionalities3.ExternalResources = append(functionalities3.ExternalResources, externalResources1) - } else { - functionalities3.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities3.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities3.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities3.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities3.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities3.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities3.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities3.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities3.ID = types.StringPointerValue(functionalitiesItem1.ID) - if len(functionalitiesItem1.Labels) > 0 { - functionalities3.Labels = make(map[string]types.String) - for key1, value1 := range functionalitiesItem1.Labels { - functionalities3.Labels[key1] = types.StringValue(value1) - } - } - functionalities3.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem1.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities3.Links) { - functionalities3.Links = append(functionalities3.Links, links1) - } else { - functionalities3.Links[linksCount].HrefURL = links1.HrefURL - functionalities3.Links[linksCount].IconURL = links1.IconURL - functionalities3.Links[linksCount].ID = links1.ID - functionalities3.Links[linksCount].Name = links1.Name - } - } - functionalities3.Name = types.StringPointerValue(functionalitiesItem1.Name) - if functionalitiesItem1.Owner == nil { - functionalities3.Owner = nil - } else { - functionalities3.Owner = &tfTypes.TeamEntity1{} - } - functionalities3.Slug = types.StringPointerValue(functionalitiesItem1.Slug) - if functionalitiesItem1.UpdatedAt != nil { - functionalities3.UpdatedAt = types.StringValue(functionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.UpdatedAt = types.StringNull() - } - if functionalitiesItem1.UpdatedBy == nil { - functionalities3.UpdatedBy = nil - } else { - functionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities3.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Email) - functionalities3.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem1.UpdatedBy.ID) - functionalities3.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Name) - functionalities3.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Source) - } - if functionalitiesCount1+1 > len(teams1.Functionalities) { - teams1.Functionalities = append(teams1.Functionalities, functionalities3) - } else { - teams1.Functionalities[functionalitiesCount1].ActiveIncidents = functionalities3.ActiveIncidents - teams1.Functionalities[functionalitiesCount1].AlertOnAdd = functionalities3.AlertOnAdd - teams1.Functionalities[functionalitiesCount1].AutoAddRespondingTeam = functionalities3.AutoAddRespondingTeam - teams1.Functionalities[functionalitiesCount1].CreatedAt = functionalities3.CreatedAt - teams1.Functionalities[functionalitiesCount1].Description = functionalities3.Description - teams1.Functionalities[functionalitiesCount1].ExternalResources = functionalities3.ExternalResources - teams1.Functionalities[functionalitiesCount1].ID = functionalities3.ID - teams1.Functionalities[functionalitiesCount1].Labels = functionalities3.Labels - teams1.Functionalities[functionalitiesCount1].Links = functionalities3.Links - teams1.Functionalities[functionalitiesCount1].Name = functionalities3.Name - teams1.Functionalities[functionalitiesCount1].Owner = functionalities3.Owner - teams1.Functionalities[functionalitiesCount1].Slug = functionalities3.Slug - teams1.Functionalities[functionalitiesCount1].UpdatedAt = functionalities3.UpdatedAt - teams1.Functionalities[functionalitiesCount1].UpdatedBy = functionalities3.UpdatedBy - } - } - teams1.ID = types.StringPointerValue(teamsItem.ID) - teams1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range teamsItem.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(teams1.Memberships) { - teams1.Memberships = append(teams1.Memberships, memberships1) - } else { - teams1.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - teams1.Memberships[membershipsCount].Schedule = memberships1.Schedule - teams1.Memberships[membershipsCount].User = memberships1.User - } - } - if teamsItem.MsTeamsChannel == nil { - teams1.MsTeamsChannel = nil - } else { - teams1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams1.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelID) - teams1.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelName) - teams1.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelURL) - teams1.MsTeamsChannel.ID = types.StringPointerValue(teamsItem.MsTeamsChannel.ID) - teams1.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem.MsTeamsChannel.MsTeamID) - teams1.MsTeamsChannel.Status = types.StringPointerValue(teamsItem.MsTeamsChannel.Status) - teams1.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem.MsTeamsChannel.TeamName) - } - teams1.Name = types.StringPointerValue(teamsItem.Name) - teams1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range teamsItem.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key2, value2 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key2] = types.StringValue(value2) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(teams1.OwnedFunctionalities) { - teams1.OwnedFunctionalities = append(teams1.OwnedFunctionalities, ownedFunctionalities1) - } else { - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - teams1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range teamsItem.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(teams1.OwnedRunbooks) { - teams1.OwnedRunbooks = append(teams1.OwnedRunbooks, ownedRunbooks1) - } else { - teams1.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - teams1.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - teams1.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - teams1.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - teams1.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - teams1.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - teams1.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - teams1.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - teams1.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - teams1.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - teams1.SignalsIcalURL = types.StringPointerValue(teamsItem.SignalsIcalURL) - if teamsItem.SlackChannel == nil { - teams1.SlackChannel = nil - } else { - teams1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams1.SlackChannel.ID = types.StringPointerValue(teamsItem.SlackChannel.ID) - teams1.SlackChannel.Name = types.StringPointerValue(teamsItem.SlackChannel.Name) - teams1.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem.SlackChannel.SlackChannelID) - } - teams1.Slug = types.StringPointerValue(teamsItem.Slug) - if teamsItem.UpdatedAt != nil { - teams1.UpdatedAt = types.StringValue(teamsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams1.UpdatedAt = types.StringNull() - } - if teamsCount+1 > len(data1.TemplateValues.Teams) { - data1.TemplateValues.Teams = append(data1.TemplateValues.Teams, teams1) - } else { - data1.TemplateValues.Teams[teamsCount].CreatedAt = teams1.CreatedAt - data1.TemplateValues.Teams[teamsCount].CreatedBy = teams1.CreatedBy - data1.TemplateValues.Teams[teamsCount].Description = teams1.Description - data1.TemplateValues.Teams[teamsCount].Functionalities = teams1.Functionalities - data1.TemplateValues.Teams[teamsCount].ID = teams1.ID - data1.TemplateValues.Teams[teamsCount].Memberships = teams1.Memberships - data1.TemplateValues.Teams[teamsCount].MsTeamsChannel = teams1.MsTeamsChannel - data1.TemplateValues.Teams[teamsCount].Name = teams1.Name - data1.TemplateValues.Teams[teamsCount].OwnedFunctionalities = teams1.OwnedFunctionalities - data1.TemplateValues.Teams[teamsCount].OwnedRunbooks = teams1.OwnedRunbooks - data1.TemplateValues.Teams[teamsCount].SignalsIcalURL = teams1.SignalsIcalURL - data1.TemplateValues.Teams[teamsCount].SlackChannel = teams1.SlackChannel - data1.TemplateValues.Teams[teamsCount].Slug = teams1.Slug - data1.TemplateValues.Teams[teamsCount].UpdatedAt = teams1.UpdatedAt - } - } - } - if dataItem.UpdatedAt != nil { - data1.UpdatedAt = types.StringValue(dataItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.UpdatedAt = types.StringNull() - } - if dataCount+1 > len(r.Data) { - r.Data = append(r.Data, data1) - } else { - r.Data[dataCount].CreatedAt = data1.CreatedAt - r.Data[dataCount].ID = data1.ID - r.Data[dataCount].Name = data1.Name - r.Data[dataCount].Template = data1.Template - r.Data[dataCount].TemplateValues = data1.TemplateValues - r.Data[dataCount].UpdatedAt = data1.UpdatedAt - } - } - if resp.Pagination == nil { - r.Pagination = nil - } else { - r.Pagination = &tfTypes.PaginationEntity{} - if resp.Pagination.Count != nil { - r.Pagination.Count = types.Int64Value(int64(*resp.Pagination.Count)) - } else { - r.Pagination.Count = types.Int64Null() - } - if resp.Pagination.Items != nil { - r.Pagination.Items = types.Int64Value(int64(*resp.Pagination.Items)) - } else { - r.Pagination.Items = types.Int64Null() - } - if resp.Pagination.Last != nil { - r.Pagination.Last = types.Int64Value(int64(*resp.Pagination.Last)) - } else { - r.Pagination.Last = types.Int64Null() - } - if resp.Pagination.Next != nil { - r.Pagination.Next = types.Int64Value(int64(*resp.Pagination.Next)) - } else { - r.Pagination.Next = types.Int64Null() - } - if resp.Pagination.Page != nil { - r.Pagination.Page = types.Int64Value(int64(*resp.Pagination.Page)) - } else { - r.Pagination.Page = types.Int64Null() - } - if resp.Pagination.Pages != nil { - r.Pagination.Pages = types.Int64Value(int64(*resp.Pagination.Pages)) - } else { - r.Pagination.Pages = types.Int64Null() - } - if resp.Pagination.Prev != nil { - r.Pagination.Prev = types.Int64Value(int64(*resp.Pagination.Prev)) - } else { - r.Pagination.Prev = types.Int64Null() - } - } - } -} diff --git a/internal/provider/priorities_data_source.go b/internal/provider/priorities_data_source.go deleted file mode 100644 index cd83f3d..0000000 --- a/internal/provider/priorities_data_source.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &PrioritiesDataSource{} -var _ datasource.DataSourceWithConfigure = &PrioritiesDataSource{} - -func NewPrioritiesDataSource() datasource.DataSource { - return &PrioritiesDataSource{} -} - -// PrioritiesDataSource is the data source implementation. -type PrioritiesDataSource struct { - client *sdk.Firehydrant -} - -// PrioritiesDataSourceModel describes the data model. -type PrioritiesDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Default types.Bool `tfsdk:"default"` - Description types.String `tfsdk:"description"` - Page types.Int64 `tfsdk:"page"` - PerPage types.Int64 `tfsdk:"per_page"` - Position types.Int64 `tfsdk:"position"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *PrioritiesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_priorities" -} - -// Schema defines the schema for the data source. -func (r *PrioritiesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Priorities DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "default": schema.BoolAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "position": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *PrioritiesDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *PrioritiesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *PrioritiesDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - request := operations.GetV1PrioritiesRequest{ - Page: page, - PerPage: perPage, - } - res, err := r.client.Priorities.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/priorities_data_source_sdk.go b/internal/provider/priorities_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/priorities_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/priority_data_source.go b/internal/provider/priority_data_source.go deleted file mode 100644 index a1cf584..0000000 --- a/internal/provider/priority_data_source.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &PriorityDataSource{} -var _ datasource.DataSourceWithConfigure = &PriorityDataSource{} - -func NewPriorityDataSource() datasource.DataSource { - return &PriorityDataSource{} -} - -// PriorityDataSource is the data source implementation. -type PriorityDataSource struct { - client *sdk.Firehydrant -} - -// PriorityDataSourceModel describes the data model. -type PriorityDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Default types.Bool `tfsdk:"default"` - Description types.String `tfsdk:"description"` - Position types.Int64 `tfsdk:"position"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *PriorityDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_priority" -} - -// Schema defines the schema for the data source. -func (r *PriorityDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Priority DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "default": schema.BoolAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "position": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *PriorityDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *PriorityDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *PriorityDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var prioritySlug string - prioritySlug = data.Slug.ValueString() - - request := operations.GetV1PrioritiesPrioritySlugRequest{ - PrioritySlug: prioritySlug, - } - res, err := r.client.Priorities.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/priority_data_source_sdk.go b/internal/provider/priority_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/priority_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/priority_resource.go b/internal/provider/priority_resource.go deleted file mode 100644 index bd052ef..0000000 --- a/internal/provider/priority_resource.go +++ /dev/null @@ -1,279 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &PriorityResource{} -var _ resource.ResourceWithImportState = &PriorityResource{} - -func NewPriorityResource() resource.Resource { - return &PriorityResource{} -} - -// PriorityResource defines the resource implementation. -type PriorityResource struct { - client *sdk.Firehydrant -} - -// PriorityResourceModel describes the resource data model. -type PriorityResourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Default types.Bool `tfsdk:"default"` - Description types.String `tfsdk:"description"` - Position types.Int64 `tfsdk:"position"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *PriorityResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_priority" -} - -func (r *PriorityResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Priority Resource", - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "default": schema.BoolAttribute{ - Computed: true, - Optional: true, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "position": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Required: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *PriorityResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *PriorityResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *PriorityResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1Priorities() - res, err := r.client.Priorities.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *PriorityResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *PriorityResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var prioritySlug string - prioritySlug = data.Slug.ValueString() - - request := operations.GetV1PrioritiesPrioritySlugRequest{ - PrioritySlug: prioritySlug, - } - res, err := r.client.Priorities.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *PriorityResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *PriorityResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var prioritySlug string - prioritySlug = data.Slug.ValueString() - - patchV1PrioritiesPrioritySlug := *data.ToSharedPatchV1PrioritiesPrioritySlug() - request := operations.PatchV1PrioritiesPrioritySlugRequest{ - PrioritySlug: prioritySlug, - PatchV1PrioritiesPrioritySlug: patchV1PrioritiesPrioritySlug, - } - res, err := r.client.Priorities.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *PriorityResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *PriorityResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var prioritySlug string - prioritySlug = data.Slug.ValueString() - - request := operations.DeleteV1PrioritiesPrioritySlugRequest{ - PrioritySlug: prioritySlug, - } - res, err := r.client.Priorities.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *PriorityResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("slug"), req.ID)...) -} diff --git a/internal/provider/priority_resource_sdk.go b/internal/provider/priority_resource_sdk.go deleted file mode 100644 index af612ad..0000000 --- a/internal/provider/priority_resource_sdk.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" -) - -func (r *PriorityResourceModel) ToSharedPostV1Priorities() *shared.PostV1Priorities { - var slug string - slug = r.Slug.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - defaultVar := new(bool) - if !r.Default.IsUnknown() && !r.Default.IsNull() { - *defaultVar = r.Default.ValueBool() - } else { - defaultVar = nil - } - out := shared.PostV1Priorities{ - Slug: slug, - Description: description, - Default: defaultVar, - } - return &out -} - -func (r *PriorityResourceModel) ToSharedPatchV1PrioritiesPrioritySlug() *shared.PatchV1PrioritiesPrioritySlug { - slug := new(string) - if !r.Slug.IsUnknown() && !r.Slug.IsNull() { - *slug = r.Slug.ValueString() - } else { - slug = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - defaultVar := new(bool) - if !r.Default.IsUnknown() && !r.Default.IsNull() { - *defaultVar = r.Default.ValueBool() - } else { - defaultVar = nil - } - out := shared.PatchV1PrioritiesPrioritySlug{ - Slug: slug, - Description: description, - Default: defaultVar, - } - return &out -} diff --git a/internal/provider/provider.go b/internal/provider/provider.go deleted file mode 100644 index 2e0538f..0000000 --- a/internal/provider/provider.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/provider" - "github.com/hashicorp/terraform-plugin-framework/provider/schema" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/types" - "net/http" -) - -var _ provider.Provider = &FirehydrantProvider{} - -type FirehydrantProvider struct { - // version is set to the provider version on release, "dev" when the - // provider is built and ran locally, and "test" when running acceptance - // testing. - version string -} - -// FirehydrantProviderModel describes the provider data model. -type FirehydrantProviderModel struct { - ServerURL types.String `tfsdk:"server_url"` - APIKey types.String `tfsdk:"api_key"` -} - -func (p *FirehydrantProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) { - resp.TypeName = "firehydrant" - resp.Version = p.version -} - -func (p *FirehydrantProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) { - resp.Schema = schema.Schema{ - Attributes: map[string]schema.Attribute{ - "server_url": schema.StringAttribute{ - MarkdownDescription: "Server URL (defaults to https://api.firehydrant.io)", - Optional: true, - Required: false, - }, - "api_key": schema.StringAttribute{ - Sensitive: true, - Optional: true, - }, - }, - } -} - -func (p *FirehydrantProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { - var data FirehydrantProviderModel - - resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - - if resp.Diagnostics.HasError() { - return - } - - ServerURL := data.ServerURL.ValueString() - - if ServerURL == "" { - ServerURL = "https://api.firehydrant.io" - } - - apiKey := new(string) - if !data.APIKey.IsUnknown() && !data.APIKey.IsNull() { - *apiKey = data.APIKey.ValueString() - } else { - apiKey = nil - } - security := shared.Security{ - APIKey: apiKey, - } - - opts := []sdk.SDKOption{ - sdk.WithServerURL(ServerURL), - sdk.WithSecurity(security), - sdk.WithClient(http.DefaultClient), - } - client := sdk.New(opts...) - - resp.DataSourceData = client - resp.ResourceData = client -} - -func (p *FirehydrantProvider) Resources(ctx context.Context) []func() resource.Resource { - return []func() resource.Resource{ - NewChecklistTemplateResource, - NewEnvironmentResource, - NewFunctionalityResource, - NewIncidentRoleResource, - NewIncidentTypeResource, - NewPriorityResource, - NewRunbookResource, - NewServiceResource, - NewServiceDependencyResource, - NewSeverityResource, - NewStatusUpdateTemplateResource, - NewTaskListResource, - NewTeamResource, - NewWebhookResource, - } -} - -func (p *FirehydrantProvider) DataSources(ctx context.Context) []func() datasource.DataSource { - return []func() datasource.DataSource{ - NewChecklistTemplateDataSource, - NewChecklistTemplatesDataSource, - NewEnvironmentDataSource, - NewEnvironmentsDataSource, - NewFunctionalitiesDataSource, - NewFunctionalityDataSource, - NewIncidentRoleDataSource, - NewIncidentTypeDataSource, - NewIncidentTypesDataSource, - NewPrioritiesDataSource, - NewPriorityDataSource, - NewRunbookDataSource, - NewRunbooksDataSource, - NewServiceDataSource, - NewServiceDependencyDataSource, - NewServicesDataSource, - NewSeveritiesDataSource, - NewSeverityDataSource, - NewStatusUpdateTemplateDataSource, - NewStatusUpdateTemplatesDataSource, - NewTaskListDataSource, - NewTaskListsDataSource, - NewTeamDataSource, - NewTeamsDataSource, - NewUsersDataSource, - NewWebhookDataSource, - NewWebhooksDataSource, - NewWebhookTargetDataSource, - } -} - -func New(version string) func() provider.Provider { - return func() provider.Provider { - return &FirehydrantProvider{ - version: version, - } - } -} diff --git a/internal/provider/reflect/diags.go b/internal/provider/reflect/diags.go deleted file mode 100644 index 50c50c8..0000000 --- a/internal/provider/reflect/diags.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "fmt" - "reflect" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -func toTerraform5ValueErrorDiag(err error, path path.Path) diag.DiagnosticWithPath { - return diag.NewAttributeErrorDiagnostic( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert into a Terraform value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) -} - -func toTerraformValueErrorDiag(err error, path path.Path) diag.DiagnosticWithPath { - return diag.NewAttributeErrorDiagnostic( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert the Attribute value into a Terraform value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) -} - -func validateValueErrorDiag(err error, path path.Path) diag.DiagnosticWithPath { - return diag.NewAttributeErrorDiagnostic( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to validate the Terraform value type. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) -} - -func valueFromTerraformErrorDiag(err error, path path.Path) diag.DiagnosticWithPath { - return diag.NewAttributeErrorDiagnostic( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert the Terraform value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) -} - -type DiagIntoIncompatibleType struct { - Val tftypes.Value - TargetType reflect.Type - Err error -} - -func (d DiagIntoIncompatibleType) Severity() diag.Severity { - return diag.SeverityError -} - -func (d DiagIntoIncompatibleType) Summary() string { - return "Value Conversion Error" -} - -func (d DiagIntoIncompatibleType) Detail() string { - return fmt.Sprintf("An unexpected error was encountered trying to convert %T into %s. This is always an error in the provider. Please report the following to the provider developer:\n\n%s", d.Val, d.TargetType, d.Err.Error()) -} - -func (d DiagIntoIncompatibleType) Equal(o diag.Diagnostic) bool { - od, ok := o.(DiagIntoIncompatibleType) - if !ok { - return false - } - if !d.Val.Equal(od.Val) { - return false - } - if d.TargetType != od.TargetType { - return false - } - if d.Err.Error() != od.Err.Error() { - return false - } - return true -} - -type DiagNewAttributeValueIntoWrongType struct { - ValType reflect.Type - TargetType reflect.Type - SchemaType attr.Type -} - -func (d DiagNewAttributeValueIntoWrongType) Severity() diag.Severity { - return diag.SeverityError -} - -func (d DiagNewAttributeValueIntoWrongType) Summary() string { - return "Value Conversion Error" -} - -func (d DiagNewAttributeValueIntoWrongType) Detail() string { - return fmt.Sprintf("An unexpected error was encountered trying to convert into a Terraform value. This is always an error in the provider. Please report the following to the provider developer:\n\nCannot use attr.Value %s, only %s is supported because %T is the type in the schema", d.TargetType, d.ValType, d.SchemaType) -} - -func (d DiagNewAttributeValueIntoWrongType) Equal(o diag.Diagnostic) bool { - od, ok := o.(DiagNewAttributeValueIntoWrongType) - if !ok { - return false - } - if d.ValType != od.ValType { - return false - } - if d.TargetType != od.TargetType { - return false - } - if !d.SchemaType.Equal(od.SchemaType) { - return false - } - return true -} diff --git a/internal/provider/reflect/doc.go b/internal/provider/reflect/doc.go deleted file mode 100644 index e384126..0000000 --- a/internal/provider/reflect/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -// Package reflect is a forked version of https://github.com/hashicorp/terraform-plugin-framework/tree/main/internal/reflect -// that has been modified to support speakeasy's terraform generator. -// In particular, behaviour differs in that it is intended to support merging Terraform State and Terraform Plan structures -// into a single data structure, with Known Plan values overriding State values. This allows for code to be written -// that drives API calls from a single point of truth. -// Fork Commit hash is 99f28445b60580b6e39afda88a4bb469461f9bbb -package reflect diff --git a/internal/provider/reflect/generic_attr_value.go b/internal/provider/reflect/generic_attr_value.go deleted file mode 100644 index 48824d5..0000000 --- a/internal/provider/reflect/generic_attr_value.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "reflect" - - "github.com/hashicorp/terraform-plugin-framework/attr" -) - -func IsGenericAttrValue(ctx context.Context, target interface{}) bool { - return reflect.TypeOf((*attr.Value)(nil)) == reflect.TypeOf(target) -} diff --git a/internal/provider/reflect/helpers.go b/internal/provider/reflect/helpers.go deleted file mode 100644 index b17719d..0000000 --- a/internal/provider/reflect/helpers.go +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "reflect" - "regexp" - "strings" - - "github.com/hashicorp/terraform-plugin-framework/path" -) - -// trueReflectValue returns the reflect.Value for `in` after derefencing all -// the pointers and unwrapping all the interfaces. It's the concrete value -// beneath it all. -func trueReflectValue(val reflect.Value) reflect.Value { - kind := val.Type().Kind() - for kind == reflect.Interface || kind == reflect.Ptr { - innerVal := val.Elem() - if !innerVal.IsValid() { - break - } - val = innerVal - kind = val.Type().Kind() - } - return val -} - -// commaSeparatedString returns an English joining of the strings in `in`, -// using "and" and commas as appropriate. -func commaSeparatedString(in []string) string { - switch len(in) { - case 0: - return "" - case 1: - return in[0] - case 2: - return strings.Join(in, " and ") - default: - in[len(in)-1] = "and " + in[len(in)-1] - return strings.Join(in, ", ") - } -} - -// getStructTags returns a map of Terraform field names to their position in -// the tags of the struct `in`. `in` must be a struct. -func getStructTags(_ context.Context, in reflect.Value, path path.Path, opts Options) (map[string]int, error) { - tags := map[string]int{} - typ := trueReflectValue(in).Type() - if typ.Kind() != reflect.Struct { - return nil, fmt.Errorf("%s: can't get struct tags of %s, is not a struct", path, in.Type()) - } - for i := 0; i < typ.NumField(); i++ { - field := typ.Field(i) - if field.PkgPath != "" { - // skip unexported fields - continue - } - tag := field.Tag.Get(`tfsdk`) - if tag == "-" { - // skip explicitly excluded fields - continue - } - if tag == "" { - return nil, fmt.Errorf(`%s: need a struct tag for "tfsdk" on %s`, path, field.Name) - } - path := path.AtName(tag) - if !isValidFieldName(tag) { - return nil, fmt.Errorf("%s: invalid field name, must only use lowercase letters, underscores, and numbers, and must start with a letter", path) - } - if other, ok := tags[tag]; ok { - return nil, fmt.Errorf("%s: can't use field name for both %s and %s", path, typ.Field(other).Name, field.Name) - } - tags[tag] = i - } - return tags, nil -} - -// isValidFieldName returns true if `name` can be used as a field name in a -// Terraform resource or data source. -func isValidFieldName(name string) bool { - re := regexp.MustCompile("^[a-z][a-z0-9_]*$") - return re.MatchString(name) -} - -// canBeNil returns true if `target`'s type can hold a nil value -func canBeNil(target reflect.Value) bool { - switch target.Kind() { - case reflect.Ptr, reflect.Slice, reflect.Map, reflect.Interface: - // these types can all hold nils - return true - default: - // nothing else can be set to nil - return false - } -} diff --git a/internal/provider/reflect/interfaces.go b/internal/provider/reflect/interfaces.go deleted file mode 100644 index ff4416e..0000000 --- a/internal/provider/reflect/interfaces.go +++ /dev/null @@ -1,492 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "reflect" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/attr/xattr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -// Unknownable is an interface for types that can be explicitly set to known or -// unknown. -type Unknownable interface { - SetUnknown(context.Context, bool) error - SetValue(context.Context, interface{}) error - GetUnknown(context.Context) bool - GetValue(context.Context) interface{} -} - -// NewUnknownable creates a zero value of `target` (or the concrete type it's -// referencing, if it's a pointer) and calls its SetUnknown method. -// -// It is meant to be called through Into, not directly. -func NewUnknownable(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - receiver := pointerSafeZeroValue(ctx, target) - method := receiver.MethodByName("SetUnknown") - if !method.IsValid() { - err := fmt.Errorf("cannot find SetUnknown method on type %s", receiver.Type().String()) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags - } - results := method.Call([]reflect.Value{ - reflect.ValueOf(ctx), - reflect.ValueOf(!val.IsKnown()), - }) - err := results[0].Interface() - if err != nil { - var underlyingErr error - switch e := err.(type) { - case error: - underlyingErr = e - default: - underlyingErr = fmt.Errorf("unknown error type %T: %v", e, e) - } - underlyingErr = fmt.Errorf("reflection error: %w", underlyingErr) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert into a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+underlyingErr.Error(), - ) - return target, diags - } - return receiver, diags -} - -// FromUnknownable creates an attr.Value from the data in an Unknownable. -// -// It is meant to be called through FromValue, not directly. -func FromUnknownable(ctx context.Context, typ attr.Type, val Unknownable, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - if val.GetUnknown(ctx) { - tfVal := tftypes.NewValue(typ.TerraformType(ctx), tftypes.UnknownValue) - - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := res.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return res, nil - } - err := tftypes.ValidateValue(typ.TerraformType(ctx), val.GetValue(ctx)) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - - tfVal := tftypes.NewValue(typ.TerraformType(ctx), val.GetValue(ctx)) - - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := res.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return res, nil -} - -// Nullable is an interface for types that can be explicitly set to null. -type Nullable interface { - SetNull(context.Context, bool) error - SetValue(context.Context, interface{}) error - GetNull(context.Context) bool - GetValue(context.Context) interface{} -} - -// NewNullable creates a zero value of `target` (or the concrete type it's -// referencing, if it's a pointer) and calls its SetNull method. -// -// It is meant to be called through Into, not directly. -func NewNullable(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - receiver := pointerSafeZeroValue(ctx, target) - method := receiver.MethodByName("SetNull") - if !method.IsValid() { - err := fmt.Errorf("cannot find SetNull method on type %s", receiver.Type().String()) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags - } - results := method.Call([]reflect.Value{ - reflect.ValueOf(ctx), - reflect.ValueOf(val.IsNull()), - }) - err := results[0].Interface() - if err != nil { - var underlyingErr error - switch e := err.(type) { - case error: - underlyingErr = e - default: - underlyingErr = fmt.Errorf("unknown error type: %T", e) - } - underlyingErr = fmt.Errorf("reflection error: %w", underlyingErr) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert into a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+underlyingErr.Error(), - ) - return target, diags - } - return receiver, diags -} - -// FromNullable creates an attr.Value from the data in a Nullable. -// -// It is meant to be called through FromValue, not directly. -func FromNullable(ctx context.Context, typ attr.Type, val Nullable, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - if val.GetNull(ctx) { - tfVal := tftypes.NewValue(typ.TerraformType(ctx), nil) - - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := res.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return res, nil - } - err := tftypes.ValidateValue(typ.TerraformType(ctx), val.GetValue(ctx)) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - - tfVal := tftypes.NewValue(typ.TerraformType(ctx), val.GetValue(ctx)) - - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := res.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return res, diags -} - -// NewValueConverter creates a zero value of `target` (or the concrete type -// it's referencing, if it's a pointer) and calls its FromTerraform5Value -// method. -// -// It is meant to be called through Into, not directly. -func NewValueConverter(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - receiver := pointerSafeZeroValue(ctx, target) - method := receiver.MethodByName("FromTerraform5Value") - if !method.IsValid() { - err := fmt.Errorf("could not find FromTerraform5Type method on type %s", receiver.Type().String()) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert into a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags - } - results := method.Call([]reflect.Value{reflect.ValueOf(val)}) - err := results[0].Interface() - if err != nil { - var underlyingErr error - switch e := err.(type) { - case error: - underlyingErr = e - default: - underlyingErr = fmt.Errorf("unknown error type: %T", e) - } - underlyingErr = fmt.Errorf("reflection error: %w", underlyingErr) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert into a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+underlyingErr.Error(), - ) - return target, diags - } - return receiver, diags -} - -// FromValueCreator creates an attr.Value from the data in a -// tftypes.ValueCreator, calling its ToTerraform5Value method and converting -// the result to an attr.Value using `typ`. -// -// It is meant to be called from FromValue, not directly. -func FromValueCreator(ctx context.Context, typ attr.Type, val tftypes.ValueCreator, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - raw, err := val.ToTerraform5Value() - if err != nil { - return nil, append(diags, toTerraform5ValueErrorDiag(err, path)) - } - err = tftypes.ValidateValue(typ.TerraformType(ctx), raw) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - tfVal := tftypes.NewValue(typ.TerraformType(ctx), raw) - - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := res.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return res, diags -} - -// NewAttributeValue creates a new reflect.Value by calling the -// ValueFromTerraform method on `typ`. It will return an error if the returned -// `attr.Value` is not the same type as `target`. -// -// It is meant to be called through Into, not directly. -func NewAttributeValue(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - res, err := typ.ValueFromTerraform(ctx, val) - if err != nil { - return target, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := res.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return target, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, val, path)...) - - if diags.HasError() { - return target, diags - } - } - } - - if reflect.TypeOf(res) != target.Type() { - diags.Append(diag.WithPath(path, DiagNewAttributeValueIntoWrongType{ - ValType: reflect.TypeOf(res), - TargetType: target.Type(), - SchemaType: typ, - })) - return target, diags - } - return reflect.ValueOf(res), diags -} - -// FromAttributeValue creates an attr.Value from an attr.Value. It just returns -// the attr.Value it is passed or an error if there is an unexpected mismatch -// between the attr.Type and attr.Value. -// -// It is meant to be called through FromValue, not directly. -func FromAttributeValue(ctx context.Context, typ attr.Type, val attr.Value, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - // Since the reflection logic is a generic Go type implementation with - // user input, it is possible to get into awkward situations where - // the logic is expecting a certain type while a value may not be - // compatible. This check will ensure the framework raises its own - // error is there is a mismatch, rather than a terraform-plugin-go - // error or worse a panic. - // - // If this validation causes major issues, another option is to - // validate via tftypes.Type for both the type and value type. - if !typ.Equal(val.Type(ctx)) { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. "+ - "This is always an error in the provider. Please report the following to the provider developer:\n\n"+ - fmt.Sprintf("Expected type: %s\n", typ)+ - fmt.Sprintf("Value type: %s\n", val.Type(ctx))+ - fmt.Sprintf("Path: %s", path), - ) - - return nil, diags - } - - switch t := val.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return val, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - tfVal, err := val.ToTerraformValue(ctx) - if err != nil { - return val, append(diags, toTerraformValueErrorDiag(err, path)) - } - - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return val, diags - } - } - } - - return val, diags -} diff --git a/internal/provider/reflect/into.go b/internal/provider/reflect/into.go deleted file mode 100644 index 29a437f..0000000 --- a/internal/provider/reflect/into.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "math/big" - "reflect" - - "github.com/hashicorp/terraform-plugin-go/tftypes" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" -) - -// Into uses the data in `val` to populate `target`, using the reflection -// package to recursively reflect into structs and slices. If `target` is an -// attr.Value, its assignment method will be used instead of reflecting. If -// `target` is a tftypes.ValueConverter, the FromTerraformValue method will be -// used instead of using reflection. Primitives are set using the val.As -// method. Structs use reflection: each exported struct field must have a -// "tfsdk" tag with the name of the field in the tftypes.Value, and all fields -// in the tftypes.Value must have a corresponding property in the struct. Into -// will be called for each struct field. Slices will have Into called for each -// element. -func Into(ctx context.Context, typ attr.Type, val tftypes.Value, target interface{}, opts Options, path path.Path) diag.Diagnostics { - var diags diag.Diagnostics - - v := reflect.ValueOf(target) - if v.Kind() != reflect.Ptr { - err := fmt.Errorf("target must be a pointer, got %T, which is a %s", target, v.Kind()) - diags.AddAttributeError( - path, - "Value Conversion Error", - fmt.Sprintf("An unexpected error was encountered trying to convert the value. This is always an error in the provider. Please report the following to the provider developer:\n\nPath: %s\nError: %s", path.String(), err.Error()), - ) - return diags - } - result, diags := BuildValue(ctx, typ, val, v.Elem(), opts, path) - if diags.HasError() { - return diags - } - v.Elem().Set(result) - return diags -} - -// BuildValue constructs a reflect.Value of the same type as `target`, -// populated with the data in `val`. It will defensively instantiate new values -// to set, making it safe for use with pointer types which may be nil. It tries -// to give consumers the ability to override its default behaviors wherever -// possible. -func BuildValue(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - // if this isn't a valid reflect.Value, bail before we accidentally - // panic - if !target.IsValid() { - err := fmt.Errorf("invalid target") - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags - } - - // ------------------------- - // -- Fork Start ----------- - // ------------------------- - - if !val.IsKnown() { - return target, diags - } - - // ------------------------- - // -- Fork End - ----------- - // ------------------------- - - // if this is an attr.Value, build the type from that - if target.Type().Implements(reflect.TypeOf((*attr.Value)(nil)).Elem()) { - return NewAttributeValue(ctx, typ, val, target, opts, path) - } - // if this tells tftypes how to build an instance of it out of a - // tftypes.Value, well, that's what we want, so do that instead of our - // default logic. - if target.Type().Implements(reflect.TypeOf((*tftypes.ValueConverter)(nil)).Elem()) { - return NewValueConverter(ctx, typ, val, target, opts, path) - } - // if this can explicitly be set to unknown, do that - if target.Type().Implements(reflect.TypeOf((*Unknownable)(nil)).Elem()) { - res, unknownableDiags := NewUnknownable(ctx, typ, val, target, opts, path) - diags.Append(unknownableDiags...) - if diags.HasError() { - return target, diags - } - target = res - // only return if it's unknown; we want to call SetUnknown - // either way, but if the value is unknown, there's nothing - // else to do, so bail - if !val.IsKnown() { - return target, nil - } - } - // if this can explicitly be set to null, do that - if target.Type().Implements(reflect.TypeOf((*Nullable)(nil)).Elem()) { - res, nullableDiags := NewNullable(ctx, typ, val, target, opts, path) - diags.Append(nullableDiags...) - if diags.HasError() { - return target, diags - } - target = res - // only return if it's null; we want to call SetNull either - // way, but if the value is null, there's nothing else to do, - // so bail - if val.IsNull() { - return target, nil - } - } - // ------------------------- - // -- Fork Start ----------- - // ------------------------- - //if !val.IsKnown() { - // // we already handled unknown the only ways we can - // // we checked that target doesn't have a SetUnknown method we - // // can call - // // we checked that target isn't an attr.Value - // // all that's left to us now is to set it as an empty value or - // // throw an error, depending on what's in opts - // if !opts.UnhandledUnknownAsEmpty { - // diags.AddAttributeError( - // path, - // "Value Conversion Error", - // "An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ - // "Received unknown value, however the target type cannot handle unknown values. Use the corresponding `types` package type or a custom type that handles unknown values.\n\n"+ - // fmt.Sprintf("Path: %s\nTarget Type: %s\nSuggested Type: %s", path.String(), target.Type(), reflect.TypeOf(typ.ValueType(ctx))), - // ) - // return target, diags - // } - // // we want to set unhandled unknowns to the empty value - // return reflect.Zero(target.Type()), diags - //} - // ------------------------- - // -- Fork End - ----------- - // ------------------------- - - if val.IsNull() { - // we already handled null the only ways we can - // we checked that target doesn't have a SetNull method we can - // call - // we checked that target isn't an attr.Value - // all that's left to us now is to set it as an empty value or - // throw an error, depending on what's in opts - if canBeNil(target) || opts.UnhandledNullAsEmpty { - return reflect.Zero(target.Type()), nil - } - - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ - "Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that handles null values.\n\n"+ - fmt.Sprintf("Path: %s\nTarget Type: %s\nSuggested `types` Type: %s\nSuggested Pointer Type: *%s", path.String(), target.Type(), reflect.TypeOf(typ.ValueType(ctx)), target.Type()), - ) - - return target, diags - } - - // Dynamic reflection is currently only supported using an `attr.Value`, which should have happened in logic above. - if typ.TerraformType(ctx).Is(tftypes.DynamicPseudoType) { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ - "Reflection for dynamic types is currently not supported. Use the corresponding `types` package type or a custom type that handles dynamic values.\n\n"+ - fmt.Sprintf("Path: %s\nTarget Type: %s\nSuggested `types` Type: %s", path.String(), target.Type(), reflect.TypeOf(typ.ValueType(ctx))), - ) - - return target, diags - } - - // *big.Float and *big.Int are technically pointers, but we want them - // handled as numbers - if target.Type() == reflect.TypeOf(big.NewFloat(0)) || target.Type() == reflect.TypeOf(big.NewInt(0)) { - return Number(ctx, typ, val, target, opts, path) - } - switch target.Kind() { - case reflect.Struct: - val, valDiags := Struct(ctx, typ, val, target, opts, path) - diags.Append(valDiags...) - return val, diags - case reflect.Bool, reflect.String: - val, valDiags := Primitive(ctx, typ, val, target, path) - diags.Append(valDiags...) - return val, diags - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, - reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, - reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64: - // numbers are the wooooorst and need their own special handling - // because we can't just hand them off to tftypes and also - // because we can't just make people use *big.Floats, because a - // nil *big.Float will crash everything if we don't handle it - // as a special case, so let's just special case numbers and - // let people use the types they want - val, valDiags := Number(ctx, typ, val, target, opts, path) - diags.Append(valDiags...) - return val, diags - case reflect.Slice: - val, valDiags := reflectSlice(ctx, typ, val, target, opts, path) - diags.Append(valDiags...) - return val, diags - case reflect.Map: - val, valDiags := Map(ctx, typ, val, target, opts, path) - diags.Append(valDiags...) - return val, diags - case reflect.Ptr: - val, valDiags := Pointer(ctx, typ, val, target, opts, path) - diags.Append(valDiags...) - return val, diags - default: - err := fmt.Errorf("don't know how to reflect %s into %s", val.Type(), target.Type()) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags - } -} diff --git a/internal/provider/reflect/map.go b/internal/provider/reflect/map.go deleted file mode 100644 index 91e27a6..0000000 --- a/internal/provider/reflect/map.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "reflect" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/attr/xattr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -// Map creates a map value that matches the type of `target`, and populates it -// with the contents of `val`. -func Map(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - underlyingValue := trueReflectValue(target) - - // this only works with maps, so check that out first - if underlyingValue.Kind() != reflect.Map { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("expected a map type, got %s", target.Type()), - })) - return target, diags - } - if !val.Type().Is(tftypes.Map{}) { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("cannot reflect %s into a map, must be a map", val.Type().String()), - })) - return target, diags - } - elemTyper, ok := typ.(attr.TypeWithElementType) - if !ok { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("cannot reflect map using type information provided by %T, %T must be an attr.TypeWithElementType", typ, typ), - })) - return target, diags - } - - // we need our value to become a map of values so we can iterate over - // them and handle them individually - values := map[string]tftypes.Value{} - err := val.As(&values) - if err != nil { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: err, - })) - return target, diags - } - - // we need to know the type the slice is wrapping - elemType := underlyingValue.Type().Elem() - elemAttrType := elemTyper.ElementType() - - // we want an empty version of the map - m := reflect.MakeMapWithSize(underlyingValue.Type(), len(values)) - - // go over each of the values passed in, create a Go value of the right - // type for them, and add it to our new map - for key, value := range values { - // create a new Go value of the type that can go in the map - targetValue := reflect.Zero(elemType) - - // update our path so we can have nice errors - path := path.AtMapKey(key) - - // reflect the value into our new target - result, elemDiags := BuildValue(ctx, elemAttrType, value, targetValue, opts, path) - diags.Append(elemDiags...) - - if diags.HasError() { - return target, diags - } - - m.SetMapIndex(reflect.ValueOf(key), result) - } - - return m, diags -} - -// FromMap returns an attr.Value representing the data contained in `val`. -// `val` must be a map type with keys that are a string type. The attr.Value -// will be of the type produced by `typ`. -// -// It is meant to be called through FromValue, not directly. -func FromMap(ctx context.Context, typ attr.TypeWithElementType, val reflect.Value, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - tfType := typ.TerraformType(ctx) - - if val.IsNil() { - tfVal := tftypes.NewValue(tfType, nil) - - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) - - if err != nil { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from map value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - switch t := attrVal.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return attrVal, diags - } - - elemType := typ.ElementType() - tfElems := map[string]tftypes.Value{} - for _, key := range val.MapKeys() { - if key.Kind() != reflect.String { - err := fmt.Errorf("map keys must be strings, got %s", key.Type()) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert into a Terraform value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - mapKeyPath := path.AtMapKey(key.String()) - - // If the element implements xattr.ValidateableAttribute, or xattr.TypeWithValidate, - // and the element does not validate then diagnostics will be added here and returned - // before reaching the switch statement below. - val, valDiags := FromValue(ctx, elemType, val.MapIndex(key).Interface(), mapKeyPath) - - diags.Append(valDiags...) - - if diags.HasError() { - return nil, diags - } - - tfVal, err := val.ToTerraformValue(ctx) - if err != nil { - return nil, append(diags, toTerraformValueErrorDiag(err, path)) - } - - switch t := val.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: mapKeyPath, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := elemType.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, mapKeyPath)...) - - if diags.HasError() { - return nil, diags - } - } - } - - tfElems[key.String()] = tfVal - } - - err := tftypes.ValidateValue(tfType, tfElems) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - - tfVal := tftypes.NewValue(tfType, tfElems) - - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) - - if err != nil { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to map value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - switch t := attrVal.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return attrVal, diags -} diff --git a/internal/provider/reflect/number.go b/internal/provider/reflect/number.go deleted file mode 100644 index 53673b8..0000000 --- a/internal/provider/reflect/number.go +++ /dev/null @@ -1,412 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "math" - "math/big" - "reflect" - "strconv" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/attr/xattr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -// Number creates a *big.Float and populates it with the data in `val`. It then -// gets converted to the type of `target`, as long as `target` is a valid -// number type (any of the built-in int, uint, or float types, *big.Float, and -// *big.Int). -// -// Number will loudly fail when a number cannot be losslessly represented using -// the requested type. -// -// It is meant to be called through Into, not directly. -func Number(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - result := big.NewFloat(0) - err := val.As(&result) - if err != nil { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Err: err, - TargetType: target.Type(), - Val: val, - })) - return target, diags - } - roundingError := fmt.Errorf("cannot store %s in %s", result.String(), target.Type()) - roundingErrorDiag := diag.NewAttributeErrorDiagnostic( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to number. This is always an error in the provider. Please report the following to the provider developer:\n\n"+roundingError.Error(), - ) - - switch target.Type() { - case reflect.TypeOf(big.NewFloat(0)): - return reflect.ValueOf(result), diags - case reflect.TypeOf(big.NewInt(0)): - intResult, acc := result.Int(nil) - if acc != big.Exact { - return reflect.ValueOf(result), append(diags, roundingErrorDiag) - } - return reflect.ValueOf(intResult), diags - } - switch target.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, - reflect.Int64: - intResult, acc := result.Int64() - if acc != big.Exact { - return target, append(diags, roundingErrorDiag) - } - switch target.Kind() { - case reflect.Int: - if strconv.IntSize == 32 && intResult > math.MaxInt32 { - return target, append(diags, roundingErrorDiag) - } - if strconv.IntSize == 32 && intResult < math.MinInt32 { - return target, append(diags, roundingErrorDiag) - } - return reflect.ValueOf(int(intResult)), diags - case reflect.Int8: - if intResult > math.MaxInt8 { - return target, append(diags, roundingErrorDiag) - } - if intResult < math.MinInt8 { - return target, append(diags, roundingErrorDiag) - } - return reflect.ValueOf(int8(intResult)), diags - case reflect.Int16: - if intResult > math.MaxInt16 { - return target, append(diags, roundingErrorDiag) - } - if intResult < math.MinInt16 { - return target, append(diags, roundingErrorDiag) - } - return reflect.ValueOf(int16(intResult)), diags - case reflect.Int32: - if intResult > math.MaxInt32 { - return target, append(diags, roundingErrorDiag) - } - if intResult < math.MinInt32 { - return target, append(diags, roundingErrorDiag) - } - return reflect.ValueOf(int32(intResult)), diags - case reflect.Int64: - return reflect.ValueOf(intResult), diags - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, - reflect.Uint64: - uintResult, acc := result.Uint64() - if acc != big.Exact { - return target, append(diags, roundingErrorDiag) - } - switch target.Kind() { - case reflect.Uint: - if strconv.IntSize == 32 && uintResult > math.MaxUint32 { - return target, append(diags, roundingErrorDiag) - } - return reflect.ValueOf(uint(uintResult)), diags - case reflect.Uint8: - if uintResult > math.MaxUint8 { - return target, append(diags, roundingErrorDiag) - } - return reflect.ValueOf(uint8(uintResult)), diags - case reflect.Uint16: - if uintResult > math.MaxUint16 { - return target, append(diags, roundingErrorDiag) - } - return reflect.ValueOf(uint16(uintResult)), diags - case reflect.Uint32: - if uintResult > math.MaxUint32 { - return target, append(diags, roundingErrorDiag) - } - return reflect.ValueOf(uint32(uintResult)), diags - case reflect.Uint64: - return reflect.ValueOf(uintResult), diags - } - case reflect.Float32: - float64Result, _ := result.Float64() - - bf := big.NewFloat(float64Result) - - if result.Text('f', -1) != bf.Text('f', -1) { - diags.Append(roundingErrorDiag) - - return target, diags - } - - float32Result, accuracy := result.Float32() - - // Underflow - // Reference: https://pkg.go.dev/math/big#Float.Float32 - if float32Result == 0 && accuracy != big.Exact { - diags.Append(roundingErrorDiag) - - return target, diags - } - - // Overflow - // Reference: https://pkg.go.dev/math/big#Float.Float32 - if math.IsInf(float64(float32Result), 0) { - diags.Append(roundingErrorDiag) - - return target, diags - } - - return reflect.ValueOf(float32Result), diags - case reflect.Float64: - floatResult, _ := result.Float64() - - bf := big.NewFloat(floatResult) - - if result.Text('f', -1) != bf.Text('f', -1) { - diags.Append(roundingErrorDiag) - - return target, diags - } - - return reflect.ValueOf(floatResult), diags - } - err = fmt.Errorf("cannot convert number to %s", target.Type()) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to number. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags -} - -// FromInt creates an attr.Value using `typ` from an int64. -// -// It is meant to be called through FromValue, not directly. -func FromInt(ctx context.Context, typ attr.Type, val int64, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - err := tftypes.ValidateValue(tftypes.Number, val) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - tfNum := tftypes.NewValue(tftypes.Number, val) - - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := num.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return num, diags -} - -// FromUint creates an attr.Value using `typ` from a uint64. -// -// It is meant to be called through FromValue, not directly. -func FromUint(ctx context.Context, typ attr.Type, val uint64, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - err := tftypes.ValidateValue(tftypes.Number, val) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - tfNum := tftypes.NewValue(tftypes.Number, val) - - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := num.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return num, diags -} - -// FromFloat creates an attr.Value using `typ` from a float64. -// -// It is meant to be called through FromValue, not directly. -func FromFloat(ctx context.Context, typ attr.Type, val float64, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - err := tftypes.ValidateValue(tftypes.Number, val) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - tfNum := tftypes.NewValue(tftypes.Number, val) - - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := num.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return num, diags -} - -// FromBigFloat creates an attr.Value using `typ` from a *big.Float. -// -// It is meant to be called through FromValue, not directly. -func FromBigFloat(ctx context.Context, typ attr.Type, val *big.Float, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - err := tftypes.ValidateValue(tftypes.Number, val) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - tfNum := tftypes.NewValue(tftypes.Number, val) - - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := num.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return num, diags -} - -// FromBigInt creates an attr.Value using `typ` from a *big.Int. -// -// It is meant to be called through FromValue, not directly. -func FromBigInt(ctx context.Context, typ attr.Type, val *big.Int, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - fl := big.NewFloat(0).SetInt(val) - err := tftypes.ValidateValue(tftypes.Number, fl) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - tfNum := tftypes.NewValue(tftypes.Number, fl) - - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := num.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return num, diags -} diff --git a/internal/provider/reflect/options.go b/internal/provider/reflect/options.go deleted file mode 100644 index 063353f..0000000 --- a/internal/provider/reflect/options.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -const ( - SourceTypeState = iota - SourceTypePlan -) - -// Options provides configuration settings for how the reflection behavior -// works, letting callers tweak different behaviors based on their needs. -type Options struct { - // UnhandledNullAsEmpty controls whether null values should be - // translated into empty values without provider interaction, or if - // they must be explicitly handled. - UnhandledNullAsEmpty bool - - // UnhandledUnknownAsEmpty controls whether null values should be - // translated into empty values without provider interaction, or if - // they must be explicitly handled. - UnhandledUnknownAsEmpty bool - - // SourceType informs the reflection system what the source is - // such that it can make decisions based on the tfPlanOnly annotation - // The default is SourceTypeState - SourceType int -} diff --git a/internal/provider/reflect/outof.go b/internal/provider/reflect/outof.go deleted file mode 100644 index 215406a..0000000 --- a/internal/provider/reflect/outof.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "math/big" - "reflect" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -// FromValue is the inverse of Into, taking a Go value (`val`) and transforming it -// into an attr.Value using the attr.Type supplied. `val` will first be -// transformed into a tftypes.Value, then passed to `typ`'s ValueFromTerraform -// method. -func FromValue(ctx context.Context, typ attr.Type, val interface{}, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - if v, ok := val.(attr.Value); ok { - return FromAttributeValue(ctx, typ, v, path) - } - if v, ok := val.(tftypes.ValueCreator); ok { - return FromValueCreator(ctx, typ, v, path) - } - if v, ok := val.(Unknownable); ok { - return FromUnknownable(ctx, typ, v, path) - } - if v, ok := val.(Nullable); ok { - return FromNullable(ctx, typ, v, path) - } - if bf, ok := val.(*big.Float); ok { - return FromBigFloat(ctx, typ, bf, path) - } - if bi, ok := val.(*big.Int); ok { - return FromBigInt(ctx, typ, bi, path) - } - value := reflect.ValueOf(val) - kind := value.Kind() - switch kind { - case reflect.Struct: - t, ok := typ.(attr.TypeWithAttributeTypes) - if !ok { - err := fmt.Errorf("cannot use type %T as schema type %T; %T must be an attr.TypeWithAttributeTypes to hold %T", val, typ, typ, val) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - return FromStruct(ctx, t, value, path) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, - reflect.Int64: - return FromInt(ctx, typ, value.Int(), path) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, - reflect.Uint64: - return FromUint(ctx, typ, value.Uint(), path) - case reflect.Float32, reflect.Float64: - return FromFloat(ctx, typ, value.Float(), path) - case reflect.Bool: - return FromBool(ctx, typ, value.Bool(), path) - case reflect.String: - return FromString(ctx, typ, value.String(), path) - case reflect.Slice: - return FromSlice(ctx, typ, value, path) - case reflect.Map: - t, ok := typ.(attr.TypeWithElementType) - if !ok { - err := fmt.Errorf("cannot use type %T as schema type %T; %T must be an attr.TypeWithElementType to hold %T", val, typ, typ, val) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - return FromMap(ctx, t, value, path) - case reflect.Ptr: - return FromPointer(ctx, typ, value, path) - default: - err := fmt.Errorf("cannot construct attr.Type from %T (%s)", val, kind) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } -} diff --git a/internal/provider/reflect/pointer.go b/internal/provider/reflect/pointer.go deleted file mode 100644 index 215653e..0000000 --- a/internal/provider/reflect/pointer.go +++ /dev/null @@ -1,145 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "reflect" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/attr/xattr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -// Pointer builds a new zero value of the concrete type that `target` -// references, populates it with BuildValue, and takes a pointer to it. -// -// It is meant to be called through Into, not directly. -func Pointer(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - if target.Kind() != reflect.Ptr { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("cannot dereference pointer, not a pointer, is a %s (%s)", target.Type(), target.Kind()), - })) - return target, diags - } - // we may have gotten a nil pointer, so we need to create our own that - // we can set - // FORK START - pointer := target - if target.IsNil() { - pointer = reflect.New(target.Type().Elem()) - } - // FORK END - // build out whatever the pointer is pointing to - pointed, pointedDiags := BuildValue(ctx, typ, val, pointer.Elem(), opts, path) - diags.Append(pointedDiags...) - - if diags.HasError() { - return target, diags - } - // to be able to set the pointer to our new pointer, we need to create - // a pointer to the pointer - pointerPointer := reflect.New(pointer.Type()) - // we set the pointer we created on the pointer to the pointer - pointerPointer.Elem().Set(pointer) - // then it's settable, so we can now set the concrete value we created - // on the pointer - pointerPointer.Elem().Elem().Set(pointed) - // return the pointer we created - return pointerPointer.Elem(), diags -} - -// create a zero value of concrete type underlying any number of pointers, then -// wrap it in that number of pointers again. The end result is to wind up with -// the same exact type, except now you can be sure it's pointing to actual data -// and will not give you a nil pointer dereference panic unexpectedly. -func pointerSafeZeroValue(_ context.Context, target reflect.Value) reflect.Value { - pointer := target.Type() - var pointers int - for pointer.Kind() == reflect.Ptr { - pointer = pointer.Elem() - pointers++ - } - receiver := reflect.Zero(pointer) - for i := 0; i < pointers; i++ { - newReceiver := reflect.New(receiver.Type()) - newReceiver.Elem().Set(receiver) - receiver = newReceiver - } - return receiver -} - -// FromPointer turns a pointer into an attr.Value using `typ`. If the pointer -// is nil, the attr.Value will use its null representation. If it is not nil, -// it will recurse into FromValue to find the attr.Value of the type the value -// the pointer is referencing. -// -// It is meant to be called through FromValue, not directly. -func FromPointer(ctx context.Context, typ attr.Type, value reflect.Value, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - if value.Kind() != reflect.Ptr { - err := fmt.Errorf("cannot use type %s as a pointer", value.Type()) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from pointer value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - if value.IsNil() { - tfVal := tftypes.NewValue(typ.TerraformType(ctx), nil) - - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) - - if err != nil { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from pointer value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - switch t := attrVal.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return attrVal, diags - } - - attrVal, attrValDiags := FromValue(ctx, typ, value.Elem().Interface(), path) - diags.Append(attrValDiags...) - - return attrVal, diags -} diff --git a/internal/provider/reflect/primitive.go b/internal/provider/reflect/primitive.go deleted file mode 100644 index adf648e..0000000 --- a/internal/provider/reflect/primitive.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "errors" - "reflect" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/attr/xattr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -// Primitive builds a string or boolean, depending on the type of `target`, and -// populates it with the data in `val`. -// -// It is meant to be called through `Into`, not directly. -func Primitive(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - switch target.Kind() { - case reflect.Bool: - var b bool - err := val.As(&b) - if err != nil { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: err, - })) - return target, diags - } - return reflect.ValueOf(b).Convert(target.Type()), nil - case reflect.String: - var s string - err := val.As(&s) - if err != nil { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: err, - })) - return target, diags - } - return reflect.ValueOf(s).Convert(target.Type()), nil - default: - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: errors.New("unknown type"), - })) - return target, diags - } -} - -// FromString returns an attr.Value as produced by `typ` from a string. -// -// It is meant to be called through FromValue, not directly. -func FromString(ctx context.Context, typ attr.Type, val string, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - err := tftypes.ValidateValue(tftypes.String, val) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - tfStr := tftypes.NewValue(tftypes.String, val) - - str, err := typ.ValueFromTerraform(ctx, tfStr) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := str.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfStr, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return str, diags -} - -// FromBool returns an attr.Value as produced by `typ` from a bool. -// -// It is meant to be called through FromValue, not directly. -func FromBool(ctx context.Context, typ attr.Type, val bool, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - err := tftypes.ValidateValue(tftypes.Bool, val) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - tfBool := tftypes.NewValue(tftypes.Bool, val) - - b, err := typ.ValueFromTerraform(ctx, tfBool) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := b.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfBool, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return b, diags -} diff --git a/internal/provider/reflect/slice.go b/internal/provider/reflect/slice.go deleted file mode 100644 index 79ad6b8..0000000 --- a/internal/provider/reflect/slice.go +++ /dev/null @@ -1,436 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "reflect" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/attr/xattr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -// build a slice of elements, matching the type of `target`, and fill it with -// the data in `val`. -func reflectSlice(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - // this only works with slices, so check that out first - if target.Kind() != reflect.Slice { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("expected a slice type, got %s", target.Type()), - })) - return target, diags - } - - // we need our value to become a list of values so we can iterate over - // them and handle them individually - var values []tftypes.Value - err := val.As(&values) - if err != nil { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: err, - })) - return target, diags - } - - switch t := typ.(type) { - // List or Set - case attr.TypeWithElementType: - // we need to know the type the slice is wrapping - elemType := target.Type().Elem() - elemAttrType := t.ElementType() - - // we want an empty version of the slice - slice := reflect.MakeSlice(target.Type(), 0, len(values)) - - // go over each of the values passed in, create a Go value of the right - // type for them, and add it to our new slice - for pos, value := range values { - // create a new Go value of the type that can go in the slice - targetValue := reflect.Zero(elemType) - - // update our path so we can have nice errors - valPath := path.AtListIndex(pos) - - if typ.TerraformType(ctx).Is(tftypes.Set{}) { - attrVal, err := elemAttrType.ValueFromTerraform(ctx, value) - - if err != nil { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags - } - - valPath = path.AtSetValue(attrVal) - } - - // reflect the value into our new target - val, valDiags := BuildValue(ctx, elemAttrType, value, targetValue, opts, valPath) - diags.Append(valDiags...) - - if diags.HasError() { - return target, diags - } - - // add the new target to our slice - slice = reflect.Append(slice, val) - } - - return slice, diags - - // Tuple reflection into slices is currently limited to use-cases where all tuple element types are the same. - // - // Overall, Tuple support is limited in the framework, but the main path that executes tuple reflection is the provider-defined function variadic - // parameter. All tuple elements in this variadic parameter will have the same element type. For use-cases where the variadic parameter is a dynamic type, - // all elements will have the same type of `DynamicType` and value of `DynamicValue`, with an underlying value that may be different. - case attr.TypeWithElementTypes: - // we need to know the type the slice is wrapping - elemType := target.Type().Elem() - - // we want an empty version of the slice - slice := reflect.MakeSlice(target.Type(), 0, len(values)) - - if len(t.ElementTypes()) <= 0 { - // If the tuple values are empty as well, we can just pass back an empty slice of the type we received. - if len(values) == 0 { - return slice, diags - } - - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("cannot reflect %s using type information provided by %T, tuple type contained no element types but received values", val.Type(), t), - })) - return target, diags - } - - // Ensure that all tuple element types are the same by comparing each element type to the first - multipleTypes := false - allElemTypes := t.ElementTypes() - elemAttrType := allElemTypes[0] - for _, elemType := range allElemTypes[1:] { - if !elemAttrType.Equal(elemType) { - multipleTypes = true - break - } - } - - if multipleTypes { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("cannot reflect %s using type information provided by %T, reflection support for tuples is limited to multiple elements of the same element type. Expected all element types to be %T", val.Type(), t, elemAttrType), - })) - return target, diags - } - - // go over each of the values passed in, create a Go value of the right - // type for them, and add it to our new slice - for pos, value := range values { - // create a new Go value of the type that can go in the slice - targetValue := reflect.Zero(elemType) - - // update our path so we can have nice errors - valPath := path.AtTupleIndex(pos) - - // reflect the value into our new target - val, valDiags := BuildValue(ctx, elemAttrType, value, targetValue, opts, valPath) - diags.Append(valDiags...) - - if diags.HasError() { - return target, diags - } - - // add the new target to our slice - slice = reflect.Append(slice, val) - } - - return slice, diags - default: - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("cannot reflect %s using type information provided by %T, %T must be an attr.TypeWithElementType or attr.TypeWithElementTypes", val.Type(), typ, typ), - })) - return target, diags - } -} - -// FromSlice returns an attr.Value as produced by `typ` using the data in -// `val`. `val` must be a slice. `typ` must be an attr.TypeWithElementType or -// attr.TypeWithElementTypes. If the slice is nil, the representation of null -// for `typ` will be returned. Otherwise, FromSlice will recurse into FromValue -// for each element in the slice, using the element type or types defined on -// `typ` to construct values for them. -// -// It is meant to be called through FromValue, not directly. -func FromSlice(ctx context.Context, typ attr.Type, val reflect.Value, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - // TODO: support tuples, which are attr.TypeWithElementTypes - tfType := typ.TerraformType(ctx) - - if val.IsNil() { - tfVal := tftypes.NewValue(tfType, nil) - - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) - - if err != nil { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - switch t := attrVal.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return attrVal, diags - } - - tfElems := make([]tftypes.Value, 0, val.Len()) - switch t := typ.(type) { - // List or Set - case attr.TypeWithElementType: - elemType := t.ElementType() - for i := 0; i < val.Len(); i++ { - // The underlying reflect.Slice is fetched by Index(). For set types, - // the path is value-based instead of index-based. Since there is only - // the index until the value is retrieved, this will pass the - // technically incorrect index-based path at first for framework - // debugging purposes, then correct the path afterwards. - valPath := path.AtListIndex(i) - - // If the element implements xattr.ValidateableAttribute, or xattr.TypeWithValidate, - // and the element does not validate then diagnostics will be added here and returned - // before reaching the switch statement below. - val, valDiags := FromValue(ctx, elemType, val.Index(i).Interface(), valPath) - diags.Append(valDiags...) - - if diags.HasError() { - return nil, diags - } - - tfVal, err := val.ToTerraformValue(ctx) - if err != nil { - return nil, append(diags, toTerraformValueErrorDiag(err, path)) - } - - if tfType.Is(tftypes.Set{}) { - valPath = path.AtSetValue(val) - } - - switch t := val.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: valPath, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := elemType.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, valPath)...) - - if diags.HasError() { - return nil, diags - } - } - } - - tfElems = append(tfElems, tfVal) - } - - // Tuple reflection from slices is currently limited to use-cases where all tuple element types are the same. - // - // Overall, Tuple support is limited in the framework, but the main path that executes tuple reflection is the provider-defined function variadic - // parameter. All tuple elements in this variadic parameter will have the same element type. For use-cases where the variadic parameter is a dynamic type, - // all elements will have the same type of `DynamicType` and value of `DynamicValue`, with an underlying value that may be different. - case attr.TypeWithElementTypes: - if len(t.ElementTypes()) <= 0 { - // If the tuple values are empty as well, we can just pass back an empty slice of the type we received. - if val.Len() == 0 { - break - } - - err := fmt.Errorf("cannot use type %s as schema type %T; tuple type contained no element types but received values", val.Type(), t) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - // Ensure that all tuple element types are the same by comparing each element type to the first - multipleTypes := false - allElemTypes := t.ElementTypes() - elemAttrType := allElemTypes[0] - for _, elemType := range allElemTypes[1:] { - if !elemAttrType.Equal(elemType) { - multipleTypes = true - break - } - } - - if multipleTypes { - err := fmt.Errorf("cannot use type %s as schema type %T; reflection support for tuples is limited to multiple elements of the same element type. Expected all element types to be %T", val.Type(), t, elemAttrType) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - for i := 0; i < val.Len(); i++ { - valPath := path.AtTupleIndex(i) - - // If the element implements xattr.ValidateableAttribute, or xattr.TypeWithValidate, - // and the element does not validate then diagnostics will be added here and returned - // before reaching the switch statement below. - val, valDiags := FromValue(ctx, elemAttrType, val.Index(i).Interface(), valPath) - diags.Append(valDiags...) - - if diags.HasError() { - return nil, diags - } - - tfVal, err := val.ToTerraformValue(ctx) - if err != nil { - return nil, append(diags, toTerraformValueErrorDiag(err, path)) - } - - switch t := val.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: valPath, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := elemAttrType.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, valPath)...) - - if diags.HasError() { - return nil, diags - } - } - } - - tfElems = append(tfElems, tfVal) - } - default: - err := fmt.Errorf("cannot use type %s as schema type %T; %T must be an attr.TypeWithElementType or attr.TypeWithElementTypes", val.Type(), t, t) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - err := tftypes.ValidateValue(tfType, tfElems) - if err != nil { - return nil, append(diags, validateValueErrorDiag(err, path)) - } - - tfVal := tftypes.NewValue(tfType, tfElems) - - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) - - if err != nil { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - switch t := attrVal.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return attrVal, diags -} diff --git a/internal/provider/reflect/struct.go b/internal/provider/reflect/struct.go deleted file mode 100644 index 68ea994..0000000 --- a/internal/provider/reflect/struct.go +++ /dev/null @@ -1,324 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package reflect - -import ( - "context" - "fmt" - "reflect" - "strings" - - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/attr/xattr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -// Struct builds a new struct using the data in `object`, as long as `object` -// is a `tftypes.Object`. It will take the struct type from `target`, which -// must be a struct type. -// -// The properties on `target` must be tagged with a "tfsdk" label containing -// the field name to map to that property. Every property must be tagged, and -// every property must be present in the type of `object`, and all the -// attributes in the type of `object` must have a corresponding property. -// Properties that don't map to object attributes must have a `tfsdk:"-"` tag, -// explicitly defining them as not part of the object. This is to catch typos -// and other mistakes early. -// -// Struct is meant to be called from Into, not directly. -func Struct(ctx context.Context, typ attr.Type, object tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { - var diags diag.Diagnostics - - // this only works with object values, so make sure that constraint is - // met - if target.Kind() != reflect.Struct { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: object, - TargetType: target.Type(), - Err: fmt.Errorf("expected a struct type, got %s", target.Type()), - })) - return target, diags - } - if !object.Type().Is(tftypes.Object{}) { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: object, - TargetType: target.Type(), - Err: fmt.Errorf("cannot reflect %s into a struct, must be an object", object.Type().String()), - })) - return target, diags - } - attrsType, ok := typ.(attr.TypeWithAttributeTypes) - if !ok { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: object, - TargetType: target.Type(), - Err: fmt.Errorf("cannot reflect object using type information provided by %T, %T must be an attr.TypeWithAttributeTypes", typ, typ), - })) - return target, diags - } - - // collect a map of fields that are in the object passed in - var objectFields map[string]tftypes.Value - err := object.As(&objectFields) - if err != nil { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: object, - TargetType: target.Type(), - Err: err, - })) - return target, diags - } - - // collect a map of fields that are defined in the tags of the struct - // passed in - targetFields, err := getStructTags(ctx, target, path, opts) - if err != nil { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: object, - TargetType: target.Type(), - Err: fmt.Errorf("error retrieving field names from struct tags: %w", err), - })) - return target, diags - } - - // we require an exact, 1:1 match of these fields to avoid typos - // leading to surprises, so let's ensure they have the exact same - // fields defined - var objectMissing, targetMissing []string - for field := range targetFields { - if _, ok := objectFields[field]; !ok { - objectMissing = append(objectMissing, field) - } - } - for field := range objectFields { - if _, ok := targetFields[field]; !ok { - targetMissing = append(targetMissing, field) - } - } - if len(objectMissing) > 0 || len(targetMissing) > 0 { - var missing []string - if len(objectMissing) > 0 { - missing = append(missing, fmt.Sprintf("Struct defines fields not found in object: %s.", commaSeparatedString(objectMissing))) - } - if len(targetMissing) > 0 { - missing = append(missing, fmt.Sprintf("Object defines fields not found in struct: %s.", commaSeparatedString(targetMissing))) - } - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: object, - TargetType: target.Type(), - Err: fmt.Errorf("mismatch between struct and object: %s", strings.Join(missing, " ")), - })) - return target, diags - } - - attrTypes := attrsType.AttributeTypes() - - // now that we know they match perfectly, fill the struct with the - // values in the object - // Fork start - //result := reflect.New(target.Type()).Elem() - var result reflect.Value - if target.CanSet() { - result = target - } else { - result = reflect.New(target.Type()).Elem() - } - structType := trueReflectValue(target).Type() - - for field, structFieldPos := range targetFields { - attrType, ok := attrTypes[field] - if !ok { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: object, - TargetType: target.Type(), - Err: fmt.Errorf("could not find type information for attribute in supplied attr.Type %T", typ), - })) - return target, diags - } - - fieldReflected := structType.Field(structFieldPos) - if opts.SourceType == SourceTypeState && fieldReflected.Tag.Get(`tfPlanOnly`) == "true" { - // skip explicitly excluded fields - continue - } - // Fork End - structField := result.Field(structFieldPos) - fieldVal, fieldValDiags := BuildValue(ctx, attrType, objectFields[field], structField, opts, path.AtName(field)) - diags.Append(fieldValDiags...) - - if diags.HasError() { - return target, diags - } - structField.Set(fieldVal) - } - return result, diags -} - -// FromStruct builds an attr.Value as produced by `typ` from the data in `val`. -// `val` must be a struct type, and must have all its properties tagged and be -// a 1:1 match with the attributes reported by `typ`. FromStruct will recurse -// into FromValue for each attribute, using the type of the attribute as -// reported by `typ`. -// -// It is meant to be called through FromValue, not directly. -func FromStruct(ctx context.Context, typ attr.TypeWithAttributeTypes, val reflect.Value, path path.Path) (attr.Value, diag.Diagnostics) { - var diags diag.Diagnostics - objTypes := map[string]tftypes.Type{} - objValues := map[string]tftypes.Value{} - - // collect a map of fields that are defined in the tags of the struct - // passed in - targetFields, err := getStructTags(ctx, val, path, Options{}) - if err != nil { - err = fmt.Errorf("error retrieving field names from struct tags: %w", err) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from struct value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags - } - - attrTypes := typ.AttributeTypes() - - var objectMissing, structMissing []string - - for field := range targetFields { - if _, ok := attrTypes[field]; !ok { - objectMissing = append(objectMissing, field) - } - } - - for attrName, attrType := range attrTypes { - if attrType == nil { - objectMissing = append(objectMissing, attrName) - } - - if _, ok := targetFields[attrName]; !ok { - structMissing = append(structMissing, attrName) - } - } - - if len(objectMissing) > 0 || len(structMissing) > 0 { - missing := make([]string, 0, len(objectMissing)+len(structMissing)) - - if len(objectMissing) > 0 { - missing = append(missing, fmt.Sprintf("Struct defines fields not found in object: %s.", commaSeparatedString(objectMissing))) - } - - if len(structMissing) > 0 { - missing = append(missing, fmt.Sprintf("Object defines fields not found in struct: %s.", commaSeparatedString(structMissing))) - } - - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from struct into an object. "+ - "This is always an error in the provider. Please report the following to the provider developer:\n\n"+ - fmt.Sprintf("Mismatch between struct and object type: %s\n", strings.Join(missing, " "))+ - fmt.Sprintf("Struct: %s\n", val.Type())+ - fmt.Sprintf("Object type: %s", typ), - ) - - return nil, diags - } - - for name, fieldNo := range targetFields { - path := path.AtName(name) - fieldValue := val.Field(fieldNo) - - // If the attr implements xattr.ValidateableAttribute, or xattr.TypeWithValidate, - // and the attr does not validate then diagnostics will be added here and returned - // before reaching the switch statement below. - attrVal, attrValDiags := FromValue(ctx, attrTypes[name], fieldValue.Interface(), path) - diags.Append(attrValDiags...) - - if diags.HasError() { - return nil, diags - } - - tfObjVal, err := attrVal.ToTerraformValue(ctx) - if err != nil { - return nil, append(diags, toTerraformValueErrorDiag(err, path)) - } - - switch t := attrVal.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := attrTypes[name].(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfObjVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - tfObjTyp := tfObjVal.Type() - - // If the original attribute type is tftypes.DynamicPseudoType, the value could end up being - // a concrete type (like tftypes.String, tftypes.List, etc.). In this scenario, the type used - // to build the final tftypes.Object must stay as tftypes.DynamicPseudoType - if attrTypes[name].TerraformType(ctx).Is(tftypes.DynamicPseudoType) { - tfObjTyp = tftypes.DynamicPseudoType - } - - objValues[name] = tfObjVal - objTypes[name] = tfObjTyp - } - - tfVal := tftypes.NewValue(tftypes.Object{ - AttributeTypes: objTypes, - }, objValues) - - ret, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) - } - - switch t := ret.(type) { - case xattr.ValidateableAttribute: - resp := xattr.ValidateAttributeResponse{} - - t.ValidateAttribute(ctx, - xattr.ValidateAttributeRequest{ - Path: path, - }, - &resp, - ) - - diags.Append(resp.Diagnostics...) - - if diags.HasError() { - return nil, diags - } - default: - //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - } - - return ret, diags -} diff --git a/internal/provider/runbook_data_source.go b/internal/provider/runbook_data_source.go deleted file mode 100644 index a633fa6..0000000 --- a/internal/provider/runbook_data_source.go +++ /dev/null @@ -1,491 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &RunbookDataSource{} -var _ datasource.DataSourceWithConfigure = &RunbookDataSource{} - -func NewRunbookDataSource() datasource.DataSource { - return &RunbookDataSource{} -} - -// RunbookDataSource is the data source implementation. -type RunbookDataSource struct { - client *sdk.Firehydrant -} - -// RunbookDataSourceModel describes the data model. -type RunbookDataSourceModel struct { - ActionElements []tfTypes.TeamEntity1 `tfsdk:"action_elements"` - ActionID types.String `tfsdk:"action_id"` - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AsyncURL types.String `tfsdk:"async_url"` - AuthorizedBy types.String `tfsdk:"authorized_by"` - AuthorizedByID types.String `tfsdk:"authorized_by_id"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - AutoAttachToRestrictedIncidents types.Bool `tfsdk:"auto_attach_to_restricted_incidents"` - Automatable types.Bool `tfsdk:"automatable"` - Automatic types.Bool `tfsdk:"automatic"` - Categories types.String `tfsdk:"categories"` - Category types.String `tfsdk:"category"` - ChannelID types.String `tfsdk:"channel_id"` - ChannelName types.String `tfsdk:"channel_name"` - ChannelURL types.String `tfsdk:"channel_url"` - Clearable types.Bool `tfsdk:"clearable"` - Config *tfTypes.TeamEntity1 `tfsdk:"config"` - ConfigurationURL types.String `tfsdk:"configuration_url"` - ConnectionID types.String `tfsdk:"connection_id"` - ConnectionName types.String `tfsdk:"connection_name"` - ConnectionType types.String `tfsdk:"connection_type"` - CreatedAt types.String `tfsdk:"created_at"` - DefaultLogic *tfTypes.TeamEntity1 `tfsdk:"default_logic"` - DefaultRuleData *tfTypes.TeamEntity1 `tfsdk:"default_rule_data"` - DefaultValue types.String `tfsdk:"default_value"` - DelayDuration types.String `tfsdk:"delay_duration"` - Deprecated types.Bool `tfsdk:"deprecated"` - Description types.String `tfsdk:"description"` - Details *tfTypes.TeamEntity1 `tfsdk:"details"` - Discarded types.Bool `tfsdk:"discarded"` - DiscardedAt types.String `tfsdk:"discarded_at"` - Disliked types.Bool `tfsdk:"disliked"` - Dislikes types.Int64 `tfsdk:"dislikes"` - DisplayName types.String `tfsdk:"display_name"` - DocumentationURL types.String `tfsdk:"documentation_url"` - Email types.String `tfsdk:"email"` - Enabled types.Bool `tfsdk:"enabled"` - HrefURL types.String `tfsdk:"href_url"` - IconURL types.String `tfsdk:"icon_url"` - ID types.String `tfsdk:"id"` - Installed types.Bool `tfsdk:"installed"` - Integration types.String `tfsdk:"integration"` - IntegrationID types.String `tfsdk:"integration_id"` - IntegrationSlug types.String `tfsdk:"integration_slug"` - IsEditable types.Bool `tfsdk:"is_editable"` - IsMulti types.Bool `tfsdk:"is_multi"` - Label types.String `tfsdk:"label"` - Labels map[string]types.String `tfsdk:"labels"` - Liked types.Bool `tfsdk:"liked"` - Likes types.Int64 `tfsdk:"likes"` - Logic *tfTypes.TeamEntity1 `tfsdk:"logic"` - LogoURL types.String `tfsdk:"logo_url"` - MsTeamID types.String `tfsdk:"ms_team_id"` - Name types.String `tfsdk:"name"` - NatIP types.String `tfsdk:"nat_ip"` - Owner *tfTypes.TeamEntity1 `tfsdk:"owner"` - Placeholder types.String `tfsdk:"placeholder"` - Prerequisites *tfTypes.TeamEntity1 `tfsdk:"prerequisites"` - RemoteID types.String `tfsdk:"remote_id"` - RemoteURL types.String `tfsdk:"remote_url"` - Repeatable types.Bool `tfsdk:"repeatable"` - Repeats types.Bool `tfsdk:"repeats"` - RepeatsDuration types.String `tfsdk:"repeats_duration"` - Required types.Bool `tfsdk:"required"` - Rerunnable types.Bool `tfsdk:"rerunnable"` - Reruns types.Bool `tfsdk:"reruns"` - RunbookTemplateID types.String `tfsdk:"runbook_template_id"` - SetupURL types.String `tfsdk:"setup_url"` - SignalsEnabledNotificationTypes []types.String `tfsdk:"signals_enabled_notification_types"` - SignalsIcalURL types.String `tfsdk:"signals_ical_url"` - SlackChannelID types.String `tfsdk:"slack_channel_id"` - SlackLinked types.Bool `tfsdk:"slack_linked"` - SlackUserID types.String `tfsdk:"slack_user_id"` - Slug types.String `tfsdk:"slug"` - Source types.String `tfsdk:"source"` - Status types.String `tfsdk:"status"` - StepElements []tfTypes.TeamEntity1 `tfsdk:"step_elements"` - StepID types.String `tfsdk:"step_id"` - Summary types.String `tfsdk:"summary"` - SupportedRunbookTypes []types.String `tfsdk:"supported_runbook_types"` - TeamName types.String `tfsdk:"team_name"` - Text types.String `tfsdk:"text"` - Tutorial types.Bool `tfsdk:"tutorial"` - Type types.String `tfsdk:"type"` - UpdatedAt types.String `tfsdk:"updated_at"` - Value types.String `tfsdk:"value"` - Voted types.Bool `tfsdk:"voted"` -} - -// Metadata returns the data source type name. -func (r *RunbookDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_runbook" -} - -// Schema defines the schema for the data source. -func (r *RunbookDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Runbook DataSource", - - Attributes: map[string]schema.Attribute{ - "action_elements": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{}, - }, - Description: `A list of action elements`, - }, - "action_id": schema.StringAttribute{ - Computed: true, - }, - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "async_url": schema.StringAttribute{ - Computed: true, - }, - "authorized_by": schema.StringAttribute{ - Computed: true, - }, - "authorized_by_id": schema.StringAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "auto_attach_to_restricted_incidents": schema.BoolAttribute{ - Computed: true, - }, - "automatable": schema.BoolAttribute{ - Computed: true, - }, - "automatic": schema.BoolAttribute{ - Computed: true, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "category": schema.StringAttribute{ - Computed: true, - }, - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "clearable": schema.BoolAttribute{ - Computed: true, - }, - "config": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the config settings for the step.`, - }, - "configuration_url": schema.StringAttribute{ - Computed: true, - }, - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "default_logic": schema.SingleNestedAttribute{ - Computed: true, - }, - "default_rule_data": schema.SingleNestedAttribute{ - Computed: true, - }, - "default_value": schema.StringAttribute{ - Computed: true, - }, - "delay_duration": schema.StringAttribute{ - Computed: true, - }, - "deprecated": schema.BoolAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "details": schema.SingleNestedAttribute{ - Computed: true, - Description: `Integration-specific details of this connection. As identified by the integration_slug, this object will be represented by that integration's ConnectionEntity.`, - }, - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "disliked": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted negatively`, - }, - "dislikes": schema.Int64Attribute{ - Computed: true, - }, - "display_name": schema.StringAttribute{ - Computed: true, - }, - "documentation_url": schema.StringAttribute{ - Computed: true, - Description: `Location of documentation for this action`, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "enabled": schema.BoolAttribute{ - Computed: true, - }, - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "installed": schema.BoolAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "integration_id": schema.StringAttribute{ - Computed: true, - }, - "integration_slug": schema.StringAttribute{ - Computed: true, - }, - "is_editable": schema.BoolAttribute{ - Computed: true, - }, - "is_multi": schema.BoolAttribute{ - Computed: true, - }, - "label": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "liked": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted positively`, - }, - "likes": schema.Int64Attribute{ - Computed: true, - }, - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "logo_url": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "nat_ip": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "placeholder": schema.StringAttribute{ - Computed: true, - }, - "prerequisites": schema.SingleNestedAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "repeatable": schema.BoolAttribute{ - Computed: true, - }, - "repeats": schema.BoolAttribute{ - Computed: true, - }, - "repeats_duration": schema.StringAttribute{ - Computed: true, - }, - "required": schema.BoolAttribute{ - Computed: true, - }, - "rerunnable": schema.BoolAttribute{ - Computed: true, - }, - "reruns": schema.BoolAttribute{ - Computed: true, - }, - "runbook_template_id": schema.StringAttribute{ - Computed: true, - }, - "setup_url": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "step_elements": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{}, - }, - Description: `A list of step elements`, - }, - "step_id": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "supported_runbook_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - "text": schema.StringAttribute{ - Computed: true, - }, - "tutorial": schema.BoolAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - "voted": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted`, - }, - }, - } -} - -func (r *RunbookDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *RunbookDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *RunbookDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var runbookID string - runbookID = data.ID.ValueString() - - request := operations.GetV1RunbooksRunbookIDRequest{ - RunbookID: runbookID, - } - res, err := r.client.Runbooks.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/runbook_data_source_sdk.go b/internal/provider/runbook_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/runbook_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/runbook_resource.go b/internal/provider/runbook_resource.go deleted file mode 100644 index b04841b..0000000 --- a/internal/provider/runbook_resource.go +++ /dev/null @@ -1,718 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - speakeasy_stringplanmodifier "github.com/firehydrant/terraform-provider-firehydrant/internal/planmodifiers/stringplanmodifier" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - speakeasy_stringvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/stringvalidators" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &RunbookResource{} -var _ resource.ResourceWithImportState = &RunbookResource{} - -func NewRunbookResource() resource.Resource { - return &RunbookResource{} -} - -// RunbookResource defines the resource implementation. -type RunbookResource struct { - client *sdk.Firehydrant -} - -// RunbookResourceModel describes the resource data model. -type RunbookResourceModel struct { - ActionElements []tfTypes.TeamEntity1 `tfsdk:"action_elements"` - ActionID types.String `tfsdk:"action_id"` - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AsyncURL types.String `tfsdk:"async_url"` - AttachmentRule *tfTypes.AttachmentRule `tfsdk:"attachment_rule"` - AuthorizedBy types.String `tfsdk:"authorized_by"` - AuthorizedByID types.String `tfsdk:"authorized_by_id"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - AutoAttachToRestrictedIncidents types.Bool `tfsdk:"auto_attach_to_restricted_incidents"` - Automatable types.Bool `tfsdk:"automatable"` - Automatic types.Bool `tfsdk:"automatic"` - Categories types.String `tfsdk:"categories"` - Category types.String `tfsdk:"category"` - ChannelID types.String `tfsdk:"channel_id"` - ChannelName types.String `tfsdk:"channel_name"` - ChannelURL types.String `tfsdk:"channel_url"` - Clearable types.Bool `tfsdk:"clearable"` - Config *tfTypes.TeamEntity1 `tfsdk:"config"` - ConfigurationURL types.String `tfsdk:"configuration_url"` - ConnectionID types.String `tfsdk:"connection_id"` - ConnectionName types.String `tfsdk:"connection_name"` - ConnectionType types.String `tfsdk:"connection_type"` - CreatedAt types.String `tfsdk:"created_at"` - DefaultLogic *tfTypes.TeamEntity1 `tfsdk:"default_logic"` - DefaultRuleData *tfTypes.TeamEntity1 `tfsdk:"default_rule_data"` - DefaultValue types.String `tfsdk:"default_value"` - DelayDuration types.String `tfsdk:"delay_duration"` - Deprecated types.Bool `tfsdk:"deprecated"` - Description types.String `tfsdk:"description"` - Details *tfTypes.TeamEntity1 `tfsdk:"details"` - Discarded types.Bool `tfsdk:"discarded"` - DiscardedAt types.String `tfsdk:"discarded_at"` - Disliked types.Bool `tfsdk:"disliked"` - Dislikes types.Int64 `tfsdk:"dislikes"` - DisplayName types.String `tfsdk:"display_name"` - DocumentationURL types.String `tfsdk:"documentation_url"` - Email types.String `tfsdk:"email"` - Enabled types.Bool `tfsdk:"enabled"` - HrefURL types.String `tfsdk:"href_url"` - IconURL types.String `tfsdk:"icon_url"` - ID types.String `tfsdk:"id"` - Installed types.Bool `tfsdk:"installed"` - Integration types.String `tfsdk:"integration"` - IntegrationID types.String `tfsdk:"integration_id"` - IntegrationSlug types.String `tfsdk:"integration_slug"` - IsEditable types.Bool `tfsdk:"is_editable"` - IsMulti types.Bool `tfsdk:"is_multi"` - Label types.String `tfsdk:"label"` - Labels map[string]types.String `tfsdk:"labels"` - Liked types.Bool `tfsdk:"liked"` - Likes types.Int64 `tfsdk:"likes"` - Logic *tfTypes.TeamEntity1 `tfsdk:"logic"` - LogoURL types.String `tfsdk:"logo_url"` - MsTeamID types.String `tfsdk:"ms_team_id"` - Name types.String `tfsdk:"name"` - NatIP types.String `tfsdk:"nat_ip"` - Owner *tfTypes.PostV1FunctionalitiesOwner `tfsdk:"owner"` - Placeholder types.String `tfsdk:"placeholder"` - Prerequisites *tfTypes.TeamEntity1 `tfsdk:"prerequisites"` - RemoteID types.String `tfsdk:"remote_id"` - RemoteURL types.String `tfsdk:"remote_url"` - Repeatable types.Bool `tfsdk:"repeatable"` - Repeats types.Bool `tfsdk:"repeats"` - RepeatsDuration types.String `tfsdk:"repeats_duration"` - Required types.Bool `tfsdk:"required"` - Rerunnable types.Bool `tfsdk:"rerunnable"` - Reruns types.Bool `tfsdk:"reruns"` - RunbookTemplateID types.String `tfsdk:"runbook_template_id"` - SetupURL types.String `tfsdk:"setup_url"` - SignalsEnabledNotificationTypes []types.String `tfsdk:"signals_enabled_notification_types"` - SignalsIcalURL types.String `tfsdk:"signals_ical_url"` - SlackChannelID types.String `tfsdk:"slack_channel_id"` - SlackLinked types.Bool `tfsdk:"slack_linked"` - SlackUserID types.String `tfsdk:"slack_user_id"` - Slug types.String `tfsdk:"slug"` - Source types.String `tfsdk:"source"` - Status types.String `tfsdk:"status"` - StepElements []tfTypes.TeamEntity1 `tfsdk:"step_elements"` - StepID types.String `tfsdk:"step_id"` - Steps []tfTypes.PostV1RunbooksSteps `tfsdk:"steps"` - Summary types.String `tfsdk:"summary"` - SupportedRunbookTypes []types.String `tfsdk:"supported_runbook_types"` - TeamName types.String `tfsdk:"team_name"` - Text types.String `tfsdk:"text"` - Tutorial types.Bool `tfsdk:"tutorial"` - Type types.String `tfsdk:"type"` - UpdatedAt types.String `tfsdk:"updated_at"` - Value types.String `tfsdk:"value"` - Voted types.Bool `tfsdk:"voted"` -} - -func (r *RunbookResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_runbook" -} - -func (r *RunbookResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Runbook Resource", - Attributes: map[string]schema.Attribute{ - "action_elements": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{}, - }, - Description: `A list of action elements`, - }, - "action_id": schema.StringAttribute{ - Computed: true, - }, - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "async_url": schema.StringAttribute{ - Computed: true, - }, - "attachment_rule": schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.StringAttribute{ - Required: true, - Description: `The JSON logic for the attaching the runbook`, - }, - "user_data": schema.StringAttribute{ - Optional: true, - Description: `The user data for the rule`, - }, - }, - }, - "authorized_by": schema.StringAttribute{ - Computed: true, - }, - "authorized_by_id": schema.StringAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "auto_attach_to_restricted_incidents": schema.BoolAttribute{ - Computed: true, - Optional: true, - Description: `Whether or not this runbook should be automatically attached to restricted incidents. Note that setting this to ` + "`" + `true` + "`" + ` will prevent it from being attached to public incidents, even manually. Defaults to ` + "`" + `false` + "`" + `.`, - }, - "automatable": schema.BoolAttribute{ - Computed: true, - }, - "automatic": schema.BoolAttribute{ - Computed: true, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "category": schema.StringAttribute{ - Computed: true, - }, - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "clearable": schema.BoolAttribute{ - Computed: true, - }, - "config": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the config settings for the step.`, - }, - "configuration_url": schema.StringAttribute{ - Computed: true, - }, - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "default_logic": schema.SingleNestedAttribute{ - Computed: true, - }, - "default_rule_data": schema.SingleNestedAttribute{ - Computed: true, - }, - "default_value": schema.StringAttribute{ - Computed: true, - }, - "delay_duration": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "deprecated": schema.BoolAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `A longer description about the Runbook. Supports markdown format`, - }, - "details": schema.SingleNestedAttribute{ - Computed: true, - Description: `Integration-specific details of this connection. As identified by the integration_slug, this object will be represented by that integration's ConnectionEntity.`, - }, - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "disliked": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted negatively`, - }, - "dislikes": schema.Int64Attribute{ - Computed: true, - }, - "display_name": schema.StringAttribute{ - Computed: true, - }, - "documentation_url": schema.StringAttribute{ - Computed: true, - Description: `Location of documentation for this action`, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "enabled": schema.BoolAttribute{ - Computed: true, - }, - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "installed": schema.BoolAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "integration_id": schema.StringAttribute{ - Computed: true, - }, - "integration_slug": schema.StringAttribute{ - Computed: true, - }, - "is_editable": schema.BoolAttribute{ - Computed: true, - }, - "is_multi": schema.BoolAttribute{ - Computed: true, - }, - "label": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "liked": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted positively`, - }, - "likes": schema.Int64Attribute{ - Computed: true, - }, - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "logo_url": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "nat_ip": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - }, - Description: `An object representing a Team that owns the runbook`, - }, - "placeholder": schema.StringAttribute{ - Computed: true, - }, - "prerequisites": schema.SingleNestedAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "repeatable": schema.BoolAttribute{ - Computed: true, - }, - "repeats": schema.BoolAttribute{ - Computed: true, - }, - "repeats_duration": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "required": schema.BoolAttribute{ - Computed: true, - }, - "rerunnable": schema.BoolAttribute{ - Computed: true, - }, - "reruns": schema.BoolAttribute{ - Computed: true, - }, - "runbook_template_id": schema.StringAttribute{ - Computed: true, - }, - "setup_url": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "step_elements": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{}, - }, - Description: `A list of step elements`, - }, - "step_id": schema.StringAttribute{ - Computed: true, - }, - "steps": schema.ListNestedAttribute{ - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "action_id": schema.StringAttribute{ - Required: true, - Description: `ID of action to use for this step.`, - }, - "name": schema.StringAttribute{ - Required: true, - Description: `Name for step`, - }, - "rule": schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.StringAttribute{ - Required: true, - Description: `The JSON logic for the rule`, - }, - "user_data": schema.StringAttribute{ - Optional: true, - Description: `The user data for the rule`, - }, - }, - }, - }, - }, - }, - "summary": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Deprecated. Use description`, - }, - "supported_runbook_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - "text": schema.StringAttribute{ - Computed: true, - }, - "tutorial": schema.BoolAttribute{ - Computed: true, - Optional: true, - Description: `Whether or not this runbook is a tutorial runbook`, - }, - "type": schema.StringAttribute{ - Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Description: `Deprecated, but still required. Please just use 'incident'. must be one of ["incident", "general", "infrastructure", "incident_role"]; Requires replacement if changed.`, - Validators: []validator.String{ - stringvalidator.OneOf( - "incident", - "general", - "infrastructure", - "incident_role", - ), - }, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - "voted": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted`, - }, - }, - } -} - -func (r *RunbookResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *RunbookResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *RunbookResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1Runbooks() - res, err := r.client.Runbooks.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *RunbookResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *RunbookResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var runbookID string - runbookID = data.ID.ValueString() - - request := operations.GetV1RunbooksRunbookIDRequest{ - RunbookID: runbookID, - } - res, err := r.client.Runbooks.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *RunbookResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *RunbookResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var runbookID string - runbookID = data.ID.ValueString() - - putV1RunbooksRunbookID := *data.ToSharedPutV1RunbooksRunbookID() - request := operations.PutV1RunbooksRunbookIDRequest{ - RunbookID: runbookID, - PutV1RunbooksRunbookID: putV1RunbooksRunbookID, - } - res, err := r.client.Runbooks.Put(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *RunbookResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *RunbookResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var runbookID string - runbookID = data.ID.ValueString() - - request := operations.DeleteV1RunbooksRunbookIDRequest{ - RunbookID: runbookID, - } - res, err := r.client.Runbooks.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *RunbookResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/runbook_resource_sdk.go b/internal/provider/runbook_resource_sdk.go deleted file mode 100644 index 527aef0..0000000 --- a/internal/provider/runbook_resource_sdk.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" -) - -func (r *RunbookResourceModel) ToSharedPostV1Runbooks() *shared.PostV1Runbooks { - var name string - name = r.Name.ValueString() - - typeVar := shared.PostV1RunbooksType(r.Type.ValueString()) - summary := new(string) - if !r.Summary.IsUnknown() && !r.Summary.IsNull() { - *summary = r.Summary.ValueString() - } else { - summary = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - autoAttachToRestrictedIncidents := new(bool) - if !r.AutoAttachToRestrictedIncidents.IsUnknown() && !r.AutoAttachToRestrictedIncidents.IsNull() { - *autoAttachToRestrictedIncidents = r.AutoAttachToRestrictedIncidents.ValueBool() - } else { - autoAttachToRestrictedIncidents = nil - } - tutorial := new(bool) - if !r.Tutorial.IsUnknown() && !r.Tutorial.IsNull() { - *tutorial = r.Tutorial.ValueBool() - } else { - tutorial = nil - } - var owner *shared.PostV1RunbooksOwner - if r.Owner != nil { - var id string - id = r.Owner.ID.ValueString() - - owner = &shared.PostV1RunbooksOwner{ - ID: id, - } - } - var attachmentRule *shared.AttachmentRule - if r.AttachmentRule != nil { - var logic string - logic = r.AttachmentRule.Logic.ValueString() - - userData := new(string) - if !r.AttachmentRule.UserData.IsUnknown() && !r.AttachmentRule.UserData.IsNull() { - *userData = r.AttachmentRule.UserData.ValueString() - } else { - userData = nil - } - attachmentRule = &shared.AttachmentRule{ - Logic: logic, - UserData: userData, - } - } - var steps []shared.PostV1RunbooksSteps = []shared.PostV1RunbooksSteps{} - for _, stepsItem := range r.Steps { - var name1 string - name1 = stepsItem.Name.ValueString() - - var actionID string - actionID = stepsItem.ActionID.ValueString() - - var rule *shared.Rule - if stepsItem.Rule != nil { - var logic1 string - logic1 = stepsItem.Rule.Logic.ValueString() - - userData1 := new(string) - if !stepsItem.Rule.UserData.IsUnknown() && !stepsItem.Rule.UserData.IsNull() { - *userData1 = stepsItem.Rule.UserData.ValueString() - } else { - userData1 = nil - } - rule = &shared.Rule{ - Logic: logic1, - UserData: userData1, - } - } - steps = append(steps, shared.PostV1RunbooksSteps{ - Name: name1, - ActionID: actionID, - Rule: rule, - }) - } - out := shared.PostV1Runbooks{ - Name: name, - Type: typeVar, - Summary: summary, - Description: description, - AutoAttachToRestrictedIncidents: autoAttachToRestrictedIncidents, - Tutorial: tutorial, - Owner: owner, - AttachmentRule: attachmentRule, - Steps: steps, - } - return &out -} - -func (r *RunbookResourceModel) ToSharedPutV1RunbooksRunbookID() *shared.PutV1RunbooksRunbookID { - name := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name = r.Name.ValueString() - } else { - name = nil - } - summary := new(string) - if !r.Summary.IsUnknown() && !r.Summary.IsNull() { - *summary = r.Summary.ValueString() - } else { - summary = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - tutorial := new(bool) - if !r.Tutorial.IsUnknown() && !r.Tutorial.IsNull() { - *tutorial = r.Tutorial.ValueBool() - } else { - tutorial = nil - } - var owner *shared.PutV1RunbooksRunbookIDOwner - if r.Owner != nil { - id := new(string) - if !r.Owner.ID.IsUnknown() && !r.Owner.ID.IsNull() { - *id = r.Owner.ID.ValueString() - } else { - id = nil - } - owner = &shared.PutV1RunbooksRunbookIDOwner{ - ID: id, - } - } - var attachmentRule *shared.PutV1RunbooksRunbookIDAttachmentRule - if r.AttachmentRule != nil { - var logic string - logic = r.AttachmentRule.Logic.ValueString() - - userData := new(string) - if !r.AttachmentRule.UserData.IsUnknown() && !r.AttachmentRule.UserData.IsNull() { - *userData = r.AttachmentRule.UserData.ValueString() - } else { - userData = nil - } - attachmentRule = &shared.PutV1RunbooksRunbookIDAttachmentRule{ - Logic: logic, - UserData: userData, - } - } - var steps []shared.PutV1RunbooksRunbookIDSteps = []shared.PutV1RunbooksRunbookIDSteps{} - for _, stepsItem := range r.Steps { - stepID := new(string) - if !stepsItem.ActionID.IsUnknown() && !stepsItem.ActionID.IsNull() { - *stepID = stepsItem.ActionID.ValueString() - } else { - stepID = nil - } - var name1 string - name1 = stepsItem.Name.ValueString() - - var actionID string - actionID = stepsItem.ActionID.ValueString() - - var rule *shared.PutV1RunbooksRunbookIDRule - if stepsItem.Rule != nil { - var logic1 string - logic1 = stepsItem.Rule.Logic.ValueString() - - userData1 := new(string) - if !stepsItem.Rule.UserData.IsUnknown() && !stepsItem.Rule.UserData.IsNull() { - *userData1 = stepsItem.Rule.UserData.ValueString() - } else { - userData1 = nil - } - rule = &shared.PutV1RunbooksRunbookIDRule{ - Logic: logic1, - UserData: userData1, - } - } - steps = append(steps, shared.PutV1RunbooksRunbookIDSteps{ - StepID: stepID, - Name: name1, - ActionID: actionID, - Rule: rule, - }) - } - autoAttachToRestrictedIncidents := new(bool) - if !r.AutoAttachToRestrictedIncidents.IsUnknown() && !r.AutoAttachToRestrictedIncidents.IsNull() { - *autoAttachToRestrictedIncidents = r.AutoAttachToRestrictedIncidents.ValueBool() - } else { - autoAttachToRestrictedIncidents = nil - } - out := shared.PutV1RunbooksRunbookID{ - Name: name, - Summary: summary, - Description: description, - Tutorial: tutorial, - Owner: owner, - AttachmentRule: attachmentRule, - Steps: steps, - AutoAttachToRestrictedIncidents: autoAttachToRestrictedIncidents, - } - return &out -} diff --git a/internal/provider/runbooks_data_source.go b/internal/provider/runbooks_data_source.go deleted file mode 100644 index 25ba348..0000000 --- a/internal/provider/runbooks_data_source.go +++ /dev/null @@ -1,542 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &RunbooksDataSource{} -var _ datasource.DataSourceWithConfigure = &RunbooksDataSource{} - -func NewRunbooksDataSource() datasource.DataSource { - return &RunbooksDataSource{} -} - -// RunbooksDataSource is the data source implementation. -type RunbooksDataSource struct { - client *sdk.Firehydrant -} - -// RunbooksDataSourceModel describes the data model. -type RunbooksDataSourceModel struct { - ActionElements []tfTypes.TeamEntity1 `tfsdk:"action_elements"` - ActionID types.String `tfsdk:"action_id"` - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AsyncURL types.String `tfsdk:"async_url"` - AuthorizedBy types.String `tfsdk:"authorized_by"` - AuthorizedByID types.String `tfsdk:"authorized_by_id"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - AutoAttachToRestrictedIncidents types.Bool `tfsdk:"auto_attach_to_restricted_incidents"` - Automatable types.Bool `tfsdk:"automatable"` - Automatic types.Bool `tfsdk:"automatic"` - Categories types.String `tfsdk:"categories"` - Category types.String `tfsdk:"category"` - ChannelID types.String `tfsdk:"channel_id"` - ChannelName types.String `tfsdk:"channel_name"` - ChannelURL types.String `tfsdk:"channel_url"` - Clearable types.Bool `tfsdk:"clearable"` - Config *tfTypes.TeamEntity1 `tfsdk:"config"` - ConfigurationURL types.String `tfsdk:"configuration_url"` - ConnectionID types.String `tfsdk:"connection_id"` - ConnectionName types.String `tfsdk:"connection_name"` - ConnectionType types.String `tfsdk:"connection_type"` - CreatedAt types.String `tfsdk:"created_at"` - DefaultLogic *tfTypes.TeamEntity1 `tfsdk:"default_logic"` - DefaultRuleData *tfTypes.TeamEntity1 `tfsdk:"default_rule_data"` - DefaultValue types.String `tfsdk:"default_value"` - DelayDuration types.String `tfsdk:"delay_duration"` - Deprecated types.Bool `tfsdk:"deprecated"` - Description types.String `tfsdk:"description"` - Details *tfTypes.TeamEntity1 `tfsdk:"details"` - Discarded types.Bool `tfsdk:"discarded"` - DiscardedAt types.String `tfsdk:"discarded_at"` - Disliked types.Bool `tfsdk:"disliked"` - Dislikes types.Int64 `tfsdk:"dislikes"` - DisplayName types.String `tfsdk:"display_name"` - DocumentationURL types.String `tfsdk:"documentation_url"` - Email types.String `tfsdk:"email"` - Enabled types.Bool `tfsdk:"enabled"` - HrefURL types.String `tfsdk:"href_url"` - IconURL types.String `tfsdk:"icon_url"` - ID types.String `tfsdk:"id"` - Installed types.Bool `tfsdk:"installed"` - Integration types.String `tfsdk:"integration"` - IntegrationID types.String `tfsdk:"integration_id"` - IntegrationSlug types.String `tfsdk:"integration_slug"` - IsEditable types.Bool `tfsdk:"is_editable"` - IsMulti types.Bool `tfsdk:"is_multi"` - Label types.String `tfsdk:"label"` - Labels map[string]types.String `tfsdk:"labels"` - Liked types.Bool `tfsdk:"liked"` - Likes types.Int64 `tfsdk:"likes"` - Logic *tfTypes.TeamEntity1 `tfsdk:"logic"` - LogoURL types.String `tfsdk:"logo_url"` - MsTeamID types.String `tfsdk:"ms_team_id"` - Name types.String `tfsdk:"name"` - NatIP types.String `tfsdk:"nat_ip"` - Owner *tfTypes.TeamEntity1 `tfsdk:"owner"` - Owners types.String `tfsdk:"owners"` - Page types.Int64 `tfsdk:"page"` - PerPage types.Int64 `tfsdk:"per_page"` - Placeholder types.String `tfsdk:"placeholder"` - Prerequisites *tfTypes.TeamEntity1 `tfsdk:"prerequisites"` - RemoteID types.String `tfsdk:"remote_id"` - RemoteURL types.String `tfsdk:"remote_url"` - Repeatable types.Bool `tfsdk:"repeatable"` - Repeats types.Bool `tfsdk:"repeats"` - RepeatsDuration types.String `tfsdk:"repeats_duration"` - Required types.Bool `tfsdk:"required"` - Rerunnable types.Bool `tfsdk:"rerunnable"` - Reruns types.Bool `tfsdk:"reruns"` - RunbookTemplateID types.String `tfsdk:"runbook_template_id"` - SetupURL types.String `tfsdk:"setup_url"` - SignalsEnabledNotificationTypes []types.String `tfsdk:"signals_enabled_notification_types"` - SignalsIcalURL types.String `tfsdk:"signals_ical_url"` - SlackChannelID types.String `tfsdk:"slack_channel_id"` - SlackLinked types.Bool `tfsdk:"slack_linked"` - SlackUserID types.String `tfsdk:"slack_user_id"` - Slug types.String `tfsdk:"slug"` - Sort types.String `tfsdk:"sort"` - Source types.String `tfsdk:"source"` - Status types.String `tfsdk:"status"` - StepElements []tfTypes.TeamEntity1 `tfsdk:"step_elements"` - StepID types.String `tfsdk:"step_id"` - Summary types.String `tfsdk:"summary"` - SupportedRunbookTypes []types.String `tfsdk:"supported_runbook_types"` - TeamName types.String `tfsdk:"team_name"` - Text types.String `tfsdk:"text"` - Tutorial types.Bool `tfsdk:"tutorial"` - Type types.String `tfsdk:"type"` - UpdatedAt types.String `tfsdk:"updated_at"` - Value types.String `tfsdk:"value"` - Voted types.Bool `tfsdk:"voted"` -} - -// Metadata returns the data source type name. -func (r *RunbooksDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_runbooks" -} - -// Schema defines the schema for the data source. -func (r *RunbooksDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Runbooks DataSource", - - Attributes: map[string]schema.Attribute{ - "action_elements": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{}, - }, - Description: `A list of action elements`, - }, - "action_id": schema.StringAttribute{ - Computed: true, - }, - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "async_url": schema.StringAttribute{ - Computed: true, - }, - "authorized_by": schema.StringAttribute{ - Computed: true, - }, - "authorized_by_id": schema.StringAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "auto_attach_to_restricted_incidents": schema.BoolAttribute{ - Computed: true, - }, - "automatable": schema.BoolAttribute{ - Computed: true, - }, - "automatic": schema.BoolAttribute{ - Computed: true, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "category": schema.StringAttribute{ - Computed: true, - }, - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "clearable": schema.BoolAttribute{ - Computed: true, - }, - "config": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the config settings for the step.`, - }, - "configuration_url": schema.StringAttribute{ - Computed: true, - }, - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "default_logic": schema.SingleNestedAttribute{ - Computed: true, - }, - "default_rule_data": schema.SingleNestedAttribute{ - Computed: true, - }, - "default_value": schema.StringAttribute{ - Computed: true, - }, - "delay_duration": schema.StringAttribute{ - Computed: true, - }, - "deprecated": schema.BoolAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "details": schema.SingleNestedAttribute{ - Computed: true, - Description: `Integration-specific details of this connection. As identified by the integration_slug, this object will be represented by that integration's ConnectionEntity.`, - }, - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "disliked": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted negatively`, - }, - "dislikes": schema.Int64Attribute{ - Computed: true, - }, - "display_name": schema.StringAttribute{ - Computed: true, - }, - "documentation_url": schema.StringAttribute{ - Computed: true, - Description: `Location of documentation for this action`, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "enabled": schema.BoolAttribute{ - Computed: true, - }, - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "installed": schema.BoolAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "integration_id": schema.StringAttribute{ - Computed: true, - }, - "integration_slug": schema.StringAttribute{ - Computed: true, - }, - "is_editable": schema.BoolAttribute{ - Computed: true, - }, - "is_multi": schema.BoolAttribute{ - Computed: true, - }, - "label": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "liked": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted positively`, - }, - "likes": schema.Int64Attribute{ - Computed: true, - }, - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "logo_url": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `A query to search runbooks by their name`, - }, - "nat_ip": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "owners": schema.StringAttribute{ - Optional: true, - Description: `A query to search runbooks by their owners`, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "placeholder": schema.StringAttribute{ - Computed: true, - }, - "prerequisites": schema.SingleNestedAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "repeatable": schema.BoolAttribute{ - Computed: true, - }, - "repeats": schema.BoolAttribute{ - Computed: true, - }, - "repeats_duration": schema.StringAttribute{ - Computed: true, - }, - "required": schema.BoolAttribute{ - Computed: true, - }, - "rerunnable": schema.BoolAttribute{ - Computed: true, - }, - "reruns": schema.BoolAttribute{ - Computed: true, - }, - "runbook_template_id": schema.StringAttribute{ - Computed: true, - }, - "setup_url": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "sort": schema.StringAttribute{ - Optional: true, - Description: `Sort runbooks by their updated date. Accepts 'asc', 'desc'`, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "step_elements": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{}, - }, - Description: `A list of step elements`, - }, - "step_id": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "supported_runbook_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - "text": schema.StringAttribute{ - Computed: true, - }, - "tutorial": schema.BoolAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - "voted": schema.BoolAttribute{ - Computed: true, - Description: `Whether or not the current actor has voted`, - }, - }, - } -} - -func (r *RunbooksDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *RunbooksDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *RunbooksDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - name := new(string) - if !data.Name.IsUnknown() && !data.Name.IsNull() { - *name = data.Name.ValueString() - } else { - name = nil - } - owners := new(string) - if !data.Owners.IsUnknown() && !data.Owners.IsNull() { - *owners = data.Owners.ValueString() - } else { - owners = nil - } - sort := new(operations.QueryParamSort) - if !data.Sort.IsUnknown() && !data.Sort.IsNull() { - *sort = operations.QueryParamSort(data.Sort.ValueString()) - } else { - sort = nil - } - request := operations.GetV1RunbooksRequest{ - Page: page, - PerPage: perPage, - Name: name, - Owners: owners, - Sort: sort, - } - res, err := r.client.Runbooks.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/runbooks_data_source_sdk.go b/internal/provider/runbooks_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/runbooks_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/service_data_source.go b/internal/provider/service_data_source.go deleted file mode 100644 index ef855f3..0000000 --- a/internal/provider/service_data_source.go +++ /dev/null @@ -1,1832 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &ServiceDataSource{} -var _ datasource.DataSourceWithConfigure = &ServiceDataSource{} - -func NewServiceDataSource() datasource.DataSource { - return &ServiceDataSource{} -} - -// ServiceDataSource is the data source implementation. -type ServiceDataSource struct { - client *sdk.Firehydrant -} - -// ServiceDataSourceModel describes the data model. -type ServiceDataSourceModel struct { - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AllowedParams []types.String `tfsdk:"allowed_params"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - Checklists []tfTypes.Checklists `tfsdk:"checklists"` - CompletedChecks types.Int64 `tfsdk:"completed_checks"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []tfTypes.ExternalResourceEntity `tfsdk:"external_resources"` - Functionalities []tfTypes.FunctionalityEntity `tfsdk:"functionalities"` - ID types.String `tfsdk:"id"` - Labels map[string]types.String `tfsdk:"labels"` - LastImport *tfTypes.ImportsImportableResourceEntity `tfsdk:"last_import"` - Links []tfTypes.LinksEntity `tfsdk:"links"` - ManagedBy types.String `tfsdk:"managed_by"` - ManagedBySettings *tfTypes.TeamEntity1 `tfsdk:"managed_by_settings"` - Name types.String `tfsdk:"name"` - Owner *tfTypes.TeamEntity `tfsdk:"owner"` - ServiceChecklistUpdatedAt types.String `tfsdk:"service_checklist_updated_at"` - ServiceTier types.Int64 `tfsdk:"service_tier"` - Slug types.String `tfsdk:"slug"` - Teams []tfTypes.TeamEntity `tfsdk:"teams"` - UpdatedAt types.String `tfsdk:"updated_at"` - UpdatedBy *tfTypes.AuthorEntity `tfsdk:"updated_by"` -} - -// Metadata returns the data source type name. -func (r *ServiceDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_service" -} - -// Schema defines the schema for the data source. -func (r *ServiceDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Service DataSource", - - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "allowed_params": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "checklists": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of checklists associated with a service`, - }, - "completed_checks": schema.Int64Attribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - Description: `List of functionalities attached to the service`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "last_import": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "import_errors": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "data": schema.SingleNestedAttribute{ - Computed: true, - Description: `Additional error data`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "resource": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Computed: true, - }, - "resource_id": schema.StringAttribute{ - Computed: true, - }, - "resource_type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "imported_at": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this service.`, - }, - "managed_by": schema.StringAttribute{ - Computed: true, - Description: `If set, this field indicates that the service is managed by an integration and thus cannot be set manually`, - }, - "managed_by_settings": schema.SingleNestedAttribute{ - Computed: true, - Description: `Indicates the settings of the catalog that manages this service`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "service_checklist_updated_at": schema.StringAttribute{ - Computed: true, - }, - "service_tier": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of teams attached to the service`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - } -} - -func (r *ServiceDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *ServiceDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *ServiceDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var serviceID string - serviceID = data.ID.ValueString() - - request := operations.GetV1ServicesServiceIDRequest{ - ServiceID: serviceID, - } - res, err := r.client.Services.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceEntity(res.ServiceEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/service_data_source_sdk.go b/internal/provider/service_data_source_sdk.go deleted file mode 100644 index e023f2d..0000000 --- a/internal/provider/service_data_source_sdk.go +++ /dev/null @@ -1,1551 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *ServiceDataSourceModel) RefreshFromSharedServiceEntity(resp *shared.ServiceEntity) { - if resp != nil { - r.ActiveIncidents = []types.String{} - for _, v := range resp.ActiveIncidents { - r.ActiveIncidents = append(r.ActiveIncidents, types.StringValue(v)) - } - r.AlertOnAdd = types.BoolPointerValue(resp.AlertOnAdd) - r.AllowedParams = []types.String{} - for _, v := range resp.AllowedParams { - r.AllowedParams = append(r.AllowedParams, types.StringValue(v)) - } - r.AutoAddRespondingTeam = types.BoolPointerValue(resp.AutoAddRespondingTeam) - r.Checklists = []tfTypes.Checklists{} - if len(r.Checklists) > len(resp.Checklists) { - r.Checklists = r.Checklists[:len(resp.Checklists)] - } - for checklistsCount, checklistsItem := range resp.Checklists { - var checklists1 tfTypes.Checklists - checklists1.Checks = []tfTypes.ChecklistCheckEntity{} - for checksCount, checksItem := range checklistsItem.Checks { - var checks1 tfTypes.ChecklistCheckEntity - checks1.Description = types.StringPointerValue(checksItem.Description) - checks1.ID = types.StringPointerValue(checksItem.ID) - checks1.Name = types.StringPointerValue(checksItem.Name) - checks1.Status = types.BoolPointerValue(checksItem.Status) - if checksCount+1 > len(checklists1.Checks) { - checklists1.Checks = append(checklists1.Checks, checks1) - } else { - checklists1.Checks[checksCount].Description = checks1.Description - checklists1.Checks[checksCount].ID = checks1.ID - checklists1.Checks[checksCount].Name = checks1.Name - checklists1.Checks[checksCount].Status = checks1.Status - } - } - checklists1.CreatedAt = types.StringPointerValue(checklistsItem.CreatedAt) - checklists1.Description = types.StringPointerValue(checklistsItem.Description) - checklists1.ID = types.StringPointerValue(checklistsItem.ID) - checklists1.Name = types.StringPointerValue(checklistsItem.Name) - if checklistsItem.Owner == nil { - checklists1.Owner = nil - } else { - checklists1.Owner = &tfTypes.TeamEntity{} - if checklistsItem.Owner.CreatedAt != nil { - checklists1.Owner.CreatedAt = types.StringValue(checklistsItem.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.CreatedAt = types.StringNull() - } - if checklistsItem.Owner.CreatedBy == nil { - checklists1.Owner.CreatedBy = nil - } else { - checklists1.Owner.CreatedBy = &tfTypes.AuthorEntity{} - checklists1.Owner.CreatedBy.Email = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Email) - checklists1.Owner.CreatedBy.ID = types.StringPointerValue(checklistsItem.Owner.CreatedBy.ID) - checklists1.Owner.CreatedBy.Name = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Name) - checklists1.Owner.CreatedBy.Source = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Source) - } - checklists1.Owner.Description = types.StringPointerValue(checklistsItem.Owner.Description) - checklists1.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount, functionalitiesItem := range checklistsItem.Owner.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(checklists1.Owner.Functionalities) { - checklists1.Owner.Functionalities = append(checklists1.Owner.Functionalities, functionalities1) - } else { - checklists1.Owner.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - checklists1.Owner.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - checklists1.Owner.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - checklists1.Owner.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - checklists1.Owner.Functionalities[functionalitiesCount].Description = functionalities1.Description - checklists1.Owner.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - checklists1.Owner.Functionalities[functionalitiesCount].ID = functionalities1.ID - checklists1.Owner.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - checklists1.Owner.Functionalities[functionalitiesCount].Links = functionalities1.Links - checklists1.Owner.Functionalities[functionalitiesCount].Name = functionalities1.Name - checklists1.Owner.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - checklists1.Owner.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - checklists1.Owner.ID = types.StringPointerValue(checklistsItem.Owner.ID) - checklists1.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range checklistsItem.Owner.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(checklists1.Owner.Memberships) { - checklists1.Owner.Memberships = append(checklists1.Owner.Memberships, memberships1) - } else { - checklists1.Owner.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - checklists1.Owner.Memberships[membershipsCount].Schedule = memberships1.Schedule - checklists1.Owner.Memberships[membershipsCount].User = memberships1.User - } - } - if checklistsItem.Owner.MsTeamsChannel == nil { - checklists1.Owner.MsTeamsChannel = nil - } else { - checklists1.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - checklists1.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelID) - checklists1.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelName) - checklists1.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelURL) - checklists1.Owner.MsTeamsChannel.ID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ID) - checklists1.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.MsTeamID) - checklists1.Owner.MsTeamsChannel.Status = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.Status) - checklists1.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.TeamName) - } - checklists1.Owner.Name = types.StringPointerValue(checklistsItem.Owner.Name) - checklists1.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range checklistsItem.Owner.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(checklists1.Owner.OwnedFunctionalities) { - checklists1.Owner.OwnedFunctionalities = append(checklists1.Owner.OwnedFunctionalities, ownedFunctionalities1) - } else { - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - checklists1.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range checklistsItem.Owner.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(checklists1.Owner.OwnedRunbooks) { - checklists1.Owner.OwnedRunbooks = append(checklists1.Owner.OwnedRunbooks, ownedRunbooks1) - } else { - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - checklists1.Owner.SignalsIcalURL = types.StringPointerValue(checklistsItem.Owner.SignalsIcalURL) - if checklistsItem.Owner.SlackChannel == nil { - checklists1.Owner.SlackChannel = nil - } else { - checklists1.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - checklists1.Owner.SlackChannel.ID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.ID) - checklists1.Owner.SlackChannel.Name = types.StringPointerValue(checklistsItem.Owner.SlackChannel.Name) - checklists1.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.SlackChannelID) - } - checklists1.Owner.Slug = types.StringPointerValue(checklistsItem.Owner.Slug) - if checklistsItem.Owner.UpdatedAt != nil { - checklists1.Owner.UpdatedAt = types.StringValue(checklistsItem.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.UpdatedAt = types.StringNull() - } - } - if checklistsItem.UpdatedAt != nil { - checklists1.UpdatedAt = types.StringValue(checklistsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.UpdatedAt = types.StringNull() - } - if checklistsCount+1 > len(r.Checklists) { - r.Checklists = append(r.Checklists, checklists1) - } else { - r.Checklists[checklistsCount].Checks = checklists1.Checks - r.Checklists[checklistsCount].CreatedAt = checklists1.CreatedAt - r.Checklists[checklistsCount].Description = checklists1.Description - r.Checklists[checklistsCount].ID = checklists1.ID - r.Checklists[checklistsCount].Name = checklists1.Name - r.Checklists[checklistsCount].Owner = checklists1.Owner - r.Checklists[checklistsCount].UpdatedAt = checklists1.UpdatedAt - } - } - if resp.CompletedChecks != nil { - r.CompletedChecks = types.Int64Value(int64(*resp.CompletedChecks)) - } else { - r.CompletedChecks = types.Int64Null() - } - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.Description = types.StringPointerValue(resp.Description) - r.ExternalResources = []tfTypes.ExternalResourceEntity{} - if len(r.ExternalResources) > len(resp.ExternalResources) { - r.ExternalResources = r.ExternalResources[:len(resp.ExternalResources)] - } - for externalResourcesCount2, externalResourcesItem2 := range resp.ExternalResources { - var externalResources5 tfTypes.ExternalResourceEntity - externalResources5.ConnectionID = types.StringPointerValue(externalResourcesItem2.ConnectionID) - externalResources5.ConnectionName = types.StringPointerValue(externalResourcesItem2.ConnectionName) - externalResources5.ConnectionType = types.StringPointerValue(externalResourcesItem2.ConnectionType) - if externalResourcesItem2.CreatedAt != nil { - externalResources5.CreatedAt = types.StringValue(externalResourcesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.CreatedAt = types.StringNull() - } - externalResources5.Name = types.StringPointerValue(externalResourcesItem2.Name) - externalResources5.RemoteID = types.StringPointerValue(externalResourcesItem2.RemoteID) - externalResources5.RemoteURL = types.StringPointerValue(externalResourcesItem2.RemoteURL) - if externalResourcesItem2.UpdatedAt != nil { - externalResources5.UpdatedAt = types.StringValue(externalResourcesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.UpdatedAt = types.StringNull() - } - if externalResourcesCount2+1 > len(r.ExternalResources) { - r.ExternalResources = append(r.ExternalResources, externalResources5) - } else { - r.ExternalResources[externalResourcesCount2].ConnectionID = externalResources5.ConnectionID - r.ExternalResources[externalResourcesCount2].ConnectionName = externalResources5.ConnectionName - r.ExternalResources[externalResourcesCount2].ConnectionType = externalResources5.ConnectionType - r.ExternalResources[externalResourcesCount2].CreatedAt = externalResources5.CreatedAt - r.ExternalResources[externalResourcesCount2].Name = externalResources5.Name - r.ExternalResources[externalResourcesCount2].RemoteID = externalResources5.RemoteID - r.ExternalResources[externalResourcesCount2].RemoteURL = externalResources5.RemoteURL - r.ExternalResources[externalResourcesCount2].UpdatedAt = externalResources5.UpdatedAt - } - } - r.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Functionalities) > len(resp.Functionalities) { - r.Functionalities = r.Functionalities[:len(resp.Functionalities)] - } - for functionalitiesCount1, functionalitiesItem1 := range resp.Functionalities { - var functionalities3 tfTypes.FunctionalityEntity - functionalities3.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem1.ActiveIncidents { - functionalities3.ActiveIncidents = append(functionalities3.ActiveIncidents, types.StringValue(v)) - } - functionalities3.AlertOnAdd = types.BoolPointerValue(functionalitiesItem1.AlertOnAdd) - functionalities3.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem1.AutoAddRespondingTeam) - if functionalitiesItem1.CreatedAt != nil { - functionalities3.CreatedAt = types.StringValue(functionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.CreatedAt = types.StringNull() - } - functionalities3.Description = types.StringPointerValue(functionalitiesItem1.Description) - functionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount3, externalResourcesItem3 := range functionalitiesItem1.ExternalResources { - var externalResources7 tfTypes.ExternalResourceEntity - externalResources7.ConnectionID = types.StringPointerValue(externalResourcesItem3.ConnectionID) - externalResources7.ConnectionName = types.StringPointerValue(externalResourcesItem3.ConnectionName) - externalResources7.ConnectionType = types.StringPointerValue(externalResourcesItem3.ConnectionType) - if externalResourcesItem3.CreatedAt != nil { - externalResources7.CreatedAt = types.StringValue(externalResourcesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.CreatedAt = types.StringNull() - } - externalResources7.Name = types.StringPointerValue(externalResourcesItem3.Name) - externalResources7.RemoteID = types.StringPointerValue(externalResourcesItem3.RemoteID) - externalResources7.RemoteURL = types.StringPointerValue(externalResourcesItem3.RemoteURL) - if externalResourcesItem3.UpdatedAt != nil { - externalResources7.UpdatedAt = types.StringValue(externalResourcesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.UpdatedAt = types.StringNull() - } - if externalResourcesCount3+1 > len(functionalities3.ExternalResources) { - functionalities3.ExternalResources = append(functionalities3.ExternalResources, externalResources7) - } else { - functionalities3.ExternalResources[externalResourcesCount3].ConnectionID = externalResources7.ConnectionID - functionalities3.ExternalResources[externalResourcesCount3].ConnectionName = externalResources7.ConnectionName - functionalities3.ExternalResources[externalResourcesCount3].ConnectionType = externalResources7.ConnectionType - functionalities3.ExternalResources[externalResourcesCount3].CreatedAt = externalResources7.CreatedAt - functionalities3.ExternalResources[externalResourcesCount3].Name = externalResources7.Name - functionalities3.ExternalResources[externalResourcesCount3].RemoteID = externalResources7.RemoteID - functionalities3.ExternalResources[externalResourcesCount3].RemoteURL = externalResources7.RemoteURL - functionalities3.ExternalResources[externalResourcesCount3].UpdatedAt = externalResources7.UpdatedAt - } - } - functionalities3.ID = types.StringPointerValue(functionalitiesItem1.ID) - if len(functionalitiesItem1.Labels) > 0 { - functionalities3.Labels = make(map[string]types.String) - for key2, value3 := range functionalitiesItem1.Labels { - functionalities3.Labels[key2] = types.StringValue(value3) - } - } - functionalities3.Links = []tfTypes.LinksEntity{} - for linksCount2, linksItem2 := range functionalitiesItem1.Links { - var links5 tfTypes.LinksEntity - links5.HrefURL = types.StringPointerValue(linksItem2.HrefURL) - links5.IconURL = types.StringPointerValue(linksItem2.IconURL) - links5.ID = types.StringPointerValue(linksItem2.ID) - links5.Name = types.StringPointerValue(linksItem2.Name) - if linksCount2+1 > len(functionalities3.Links) { - functionalities3.Links = append(functionalities3.Links, links5) - } else { - functionalities3.Links[linksCount2].HrefURL = links5.HrefURL - functionalities3.Links[linksCount2].IconURL = links5.IconURL - functionalities3.Links[linksCount2].ID = links5.ID - functionalities3.Links[linksCount2].Name = links5.Name - } - } - functionalities3.Name = types.StringPointerValue(functionalitiesItem1.Name) - if functionalitiesItem1.Owner == nil { - functionalities3.Owner = nil - } else { - functionalities3.Owner = &tfTypes.TeamEntity1{} - } - functionalities3.Slug = types.StringPointerValue(functionalitiesItem1.Slug) - if functionalitiesItem1.UpdatedAt != nil { - functionalities3.UpdatedAt = types.StringValue(functionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.UpdatedAt = types.StringNull() - } - if functionalitiesItem1.UpdatedBy == nil { - functionalities3.UpdatedBy = nil - } else { - functionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities3.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Email) - functionalities3.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem1.UpdatedBy.ID) - functionalities3.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Name) - functionalities3.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Source) - } - if functionalitiesCount1+1 > len(r.Functionalities) { - r.Functionalities = append(r.Functionalities, functionalities3) - } else { - r.Functionalities[functionalitiesCount1].ActiveIncidents = functionalities3.ActiveIncidents - r.Functionalities[functionalitiesCount1].AlertOnAdd = functionalities3.AlertOnAdd - r.Functionalities[functionalitiesCount1].AutoAddRespondingTeam = functionalities3.AutoAddRespondingTeam - r.Functionalities[functionalitiesCount1].CreatedAt = functionalities3.CreatedAt - r.Functionalities[functionalitiesCount1].Description = functionalities3.Description - r.Functionalities[functionalitiesCount1].ExternalResources = functionalities3.ExternalResources - r.Functionalities[functionalitiesCount1].ID = functionalities3.ID - r.Functionalities[functionalitiesCount1].Labels = functionalities3.Labels - r.Functionalities[functionalitiesCount1].Links = functionalities3.Links - r.Functionalities[functionalitiesCount1].Name = functionalities3.Name - r.Functionalities[functionalitiesCount1].Owner = functionalities3.Owner - r.Functionalities[functionalitiesCount1].Slug = functionalities3.Slug - r.Functionalities[functionalitiesCount1].UpdatedAt = functionalities3.UpdatedAt - r.Functionalities[functionalitiesCount1].UpdatedBy = functionalities3.UpdatedBy - } - } - r.ID = types.StringPointerValue(resp.ID) - if len(resp.Labels) > 0 { - r.Labels = make(map[string]types.String) - for key3, value4 := range resp.Labels { - r.Labels[key3] = types.StringValue(value4) - } - } - if resp.LastImport == nil { - r.LastImport = nil - } else { - r.LastImport = &tfTypes.ImportsImportableResourceEntity{} - r.LastImport.ImportErrors = []tfTypes.ImportsImportErrorEntity{} - if len(r.LastImport.ImportErrors) > len(resp.LastImport.ImportErrors) { - r.LastImport.ImportErrors = r.LastImport.ImportErrors[:len(resp.LastImport.ImportErrors)] - } - for importErrorsCount, importErrorsItem := range resp.LastImport.ImportErrors { - var importErrors1 tfTypes.ImportsImportErrorEntity - if importErrorsItem.CreatedAt != nil { - importErrors1.CreatedAt = types.StringValue(importErrorsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - importErrors1.CreatedAt = types.StringNull() - } - if importErrorsItem.Data == nil { - importErrors1.Data = nil - } else { - importErrors1.Data = &tfTypes.TeamEntity1{} - } - importErrors1.ID = types.StringPointerValue(importErrorsItem.ID) - importErrors1.Message = types.StringPointerValue(importErrorsItem.Message) - if importErrorsItem.Resource == nil { - importErrors1.Resource = nil - } else { - importErrors1.Resource = &tfTypes.ImportsImportErrorEntityResourceEntity{} - importErrors1.Resource.Name = types.StringPointerValue(importErrorsItem.Resource.Name) - importErrors1.Resource.ResourceID = types.StringPointerValue(importErrorsItem.Resource.ResourceID) - importErrors1.Resource.ResourceType = types.StringPointerValue(importErrorsItem.Resource.ResourceType) - } - if importErrorsCount+1 > len(r.LastImport.ImportErrors) { - r.LastImport.ImportErrors = append(r.LastImport.ImportErrors, importErrors1) - } else { - r.LastImport.ImportErrors[importErrorsCount].CreatedAt = importErrors1.CreatedAt - r.LastImport.ImportErrors[importErrorsCount].Data = importErrors1.Data - r.LastImport.ImportErrors[importErrorsCount].ID = importErrors1.ID - r.LastImport.ImportErrors[importErrorsCount].Message = importErrors1.Message - r.LastImport.ImportErrors[importErrorsCount].Resource = importErrors1.Resource - } - } - if resp.LastImport.ImportedAt != nil { - r.LastImport.ImportedAt = types.StringValue(resp.LastImport.ImportedAt.Format(time.RFC3339Nano)) - } else { - r.LastImport.ImportedAt = types.StringNull() - } - r.LastImport.RemoteID = types.StringPointerValue(resp.LastImport.RemoteID) - if resp.LastImport.State != nil { - r.LastImport.State = types.StringValue(string(*resp.LastImport.State)) - } else { - r.LastImport.State = types.StringNull() - } - } - r.Links = []tfTypes.LinksEntity{} - if len(r.Links) > len(resp.Links) { - r.Links = r.Links[:len(resp.Links)] - } - for linksCount3, linksItem3 := range resp.Links { - var links7 tfTypes.LinksEntity - links7.HrefURL = types.StringPointerValue(linksItem3.HrefURL) - links7.IconURL = types.StringPointerValue(linksItem3.IconURL) - links7.ID = types.StringPointerValue(linksItem3.ID) - links7.Name = types.StringPointerValue(linksItem3.Name) - if linksCount3+1 > len(r.Links) { - r.Links = append(r.Links, links7) - } else { - r.Links[linksCount3].HrefURL = links7.HrefURL - r.Links[linksCount3].IconURL = links7.IconURL - r.Links[linksCount3].ID = links7.ID - r.Links[linksCount3].Name = links7.Name - } - } - r.ManagedBy = types.StringPointerValue(resp.ManagedBy) - if resp.ManagedBySettings == nil { - r.ManagedBySettings = nil - } else { - r.ManagedBySettings = &tfTypes.TeamEntity1{} - } - r.Name = types.StringPointerValue(resp.Name) - if resp.Owner == nil { - r.Owner = nil - } else { - r.Owner = &tfTypes.TeamEntity{} - if resp.Owner.CreatedAt != nil { - r.Owner.CreatedAt = types.StringValue(resp.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.Owner.CreatedAt = types.StringNull() - } - if resp.Owner.CreatedBy == nil { - r.Owner.CreatedBy = nil - } else { - r.Owner.CreatedBy = &tfTypes.AuthorEntity{} - r.Owner.CreatedBy.Email = types.StringPointerValue(resp.Owner.CreatedBy.Email) - r.Owner.CreatedBy.ID = types.StringPointerValue(resp.Owner.CreatedBy.ID) - r.Owner.CreatedBy.Name = types.StringPointerValue(resp.Owner.CreatedBy.Name) - r.Owner.CreatedBy.Source = types.StringPointerValue(resp.Owner.CreatedBy.Source) - } - r.Owner.Description = types.StringPointerValue(resp.Owner.Description) - r.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Owner.Functionalities) > len(resp.Owner.Functionalities) { - r.Owner.Functionalities = r.Owner.Functionalities[:len(resp.Owner.Functionalities)] - } - for functionalitiesCount2, functionalitiesItem2 := range resp.Owner.Functionalities { - var functionalities5 tfTypes.FunctionalityEntity - functionalities5.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem2.ActiveIncidents { - functionalities5.ActiveIncidents = append(functionalities5.ActiveIncidents, types.StringValue(v)) - } - functionalities5.AlertOnAdd = types.BoolPointerValue(functionalitiesItem2.AlertOnAdd) - functionalities5.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem2.AutoAddRespondingTeam) - if functionalitiesItem2.CreatedAt != nil { - functionalities5.CreatedAt = types.StringValue(functionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.CreatedAt = types.StringNull() - } - functionalities5.Description = types.StringPointerValue(functionalitiesItem2.Description) - functionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount4, externalResourcesItem4 := range functionalitiesItem2.ExternalResources { - var externalResources9 tfTypes.ExternalResourceEntity - externalResources9.ConnectionID = types.StringPointerValue(externalResourcesItem4.ConnectionID) - externalResources9.ConnectionName = types.StringPointerValue(externalResourcesItem4.ConnectionName) - externalResources9.ConnectionType = types.StringPointerValue(externalResourcesItem4.ConnectionType) - if externalResourcesItem4.CreatedAt != nil { - externalResources9.CreatedAt = types.StringValue(externalResourcesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.CreatedAt = types.StringNull() - } - externalResources9.Name = types.StringPointerValue(externalResourcesItem4.Name) - externalResources9.RemoteID = types.StringPointerValue(externalResourcesItem4.RemoteID) - externalResources9.RemoteURL = types.StringPointerValue(externalResourcesItem4.RemoteURL) - if externalResourcesItem4.UpdatedAt != nil { - externalResources9.UpdatedAt = types.StringValue(externalResourcesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.UpdatedAt = types.StringNull() - } - if externalResourcesCount4+1 > len(functionalities5.ExternalResources) { - functionalities5.ExternalResources = append(functionalities5.ExternalResources, externalResources9) - } else { - functionalities5.ExternalResources[externalResourcesCount4].ConnectionID = externalResources9.ConnectionID - functionalities5.ExternalResources[externalResourcesCount4].ConnectionName = externalResources9.ConnectionName - functionalities5.ExternalResources[externalResourcesCount4].ConnectionType = externalResources9.ConnectionType - functionalities5.ExternalResources[externalResourcesCount4].CreatedAt = externalResources9.CreatedAt - functionalities5.ExternalResources[externalResourcesCount4].Name = externalResources9.Name - functionalities5.ExternalResources[externalResourcesCount4].RemoteID = externalResources9.RemoteID - functionalities5.ExternalResources[externalResourcesCount4].RemoteURL = externalResources9.RemoteURL - functionalities5.ExternalResources[externalResourcesCount4].UpdatedAt = externalResources9.UpdatedAt - } - } - functionalities5.ID = types.StringPointerValue(functionalitiesItem2.ID) - if len(functionalitiesItem2.Labels) > 0 { - functionalities5.Labels = make(map[string]types.String) - for key4, value5 := range functionalitiesItem2.Labels { - functionalities5.Labels[key4] = types.StringValue(value5) - } - } - functionalities5.Links = []tfTypes.LinksEntity{} - for linksCount4, linksItem4 := range functionalitiesItem2.Links { - var links9 tfTypes.LinksEntity - links9.HrefURL = types.StringPointerValue(linksItem4.HrefURL) - links9.IconURL = types.StringPointerValue(linksItem4.IconURL) - links9.ID = types.StringPointerValue(linksItem4.ID) - links9.Name = types.StringPointerValue(linksItem4.Name) - if linksCount4+1 > len(functionalities5.Links) { - functionalities5.Links = append(functionalities5.Links, links9) - } else { - functionalities5.Links[linksCount4].HrefURL = links9.HrefURL - functionalities5.Links[linksCount4].IconURL = links9.IconURL - functionalities5.Links[linksCount4].ID = links9.ID - functionalities5.Links[linksCount4].Name = links9.Name - } - } - functionalities5.Name = types.StringPointerValue(functionalitiesItem2.Name) - if functionalitiesItem2.Owner == nil { - functionalities5.Owner = nil - } else { - functionalities5.Owner = &tfTypes.TeamEntity1{} - } - functionalities5.Slug = types.StringPointerValue(functionalitiesItem2.Slug) - if functionalitiesItem2.UpdatedAt != nil { - functionalities5.UpdatedAt = types.StringValue(functionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.UpdatedAt = types.StringNull() - } - if functionalitiesItem2.UpdatedBy == nil { - functionalities5.UpdatedBy = nil - } else { - functionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities5.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Email) - functionalities5.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem2.UpdatedBy.ID) - functionalities5.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Name) - functionalities5.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Source) - } - if functionalitiesCount2+1 > len(r.Owner.Functionalities) { - r.Owner.Functionalities = append(r.Owner.Functionalities, functionalities5) - } else { - r.Owner.Functionalities[functionalitiesCount2].ActiveIncidents = functionalities5.ActiveIncidents - r.Owner.Functionalities[functionalitiesCount2].AlertOnAdd = functionalities5.AlertOnAdd - r.Owner.Functionalities[functionalitiesCount2].AutoAddRespondingTeam = functionalities5.AutoAddRespondingTeam - r.Owner.Functionalities[functionalitiesCount2].CreatedAt = functionalities5.CreatedAt - r.Owner.Functionalities[functionalitiesCount2].Description = functionalities5.Description - r.Owner.Functionalities[functionalitiesCount2].ExternalResources = functionalities5.ExternalResources - r.Owner.Functionalities[functionalitiesCount2].ID = functionalities5.ID - r.Owner.Functionalities[functionalitiesCount2].Labels = functionalities5.Labels - r.Owner.Functionalities[functionalitiesCount2].Links = functionalities5.Links - r.Owner.Functionalities[functionalitiesCount2].Name = functionalities5.Name - r.Owner.Functionalities[functionalitiesCount2].Owner = functionalities5.Owner - r.Owner.Functionalities[functionalitiesCount2].Slug = functionalities5.Slug - r.Owner.Functionalities[functionalitiesCount2].UpdatedAt = functionalities5.UpdatedAt - r.Owner.Functionalities[functionalitiesCount2].UpdatedBy = functionalities5.UpdatedBy - } - } - r.Owner.ID = types.StringPointerValue(resp.Owner.ID) - r.Owner.Memberships = []tfTypes.MembershipEntity{} - if len(r.Owner.Memberships) > len(resp.Owner.Memberships) { - r.Owner.Memberships = r.Owner.Memberships[:len(resp.Owner.Memberships)] - } - for membershipsCount1, membershipsItem1 := range resp.Owner.Memberships { - var memberships3 tfTypes.MembershipEntity - if membershipsItem1.DefaultIncidentRole == nil { - memberships3.DefaultIncidentRole = nil - } else { - memberships3.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem1.DefaultIncidentRole.CreatedAt != nil { - memberships3.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Description) - if membershipsItem1.DefaultIncidentRole.DiscardedAt != nil { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.ID) - memberships3.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Name) - memberships3.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Summary) - if membershipsItem1.DefaultIncidentRole.UpdatedAt != nil { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem1.Schedule == nil { - memberships3.Schedule = nil - } else { - memberships3.Schedule = &tfTypes.ScheduleEntity{} - memberships3.Schedule.Discarded = types.BoolPointerValue(membershipsItem1.Schedule.Discarded) - memberships3.Schedule.ID = types.StringPointerValue(membershipsItem1.Schedule.ID) - memberships3.Schedule.Integration = types.StringPointerValue(membershipsItem1.Schedule.Integration) - memberships3.Schedule.Name = types.StringPointerValue(membershipsItem1.Schedule.Name) - } - if membershipsItem1.User == nil { - memberships3.User = nil - } else { - memberships3.User = &tfTypes.UserEntity{} - if membershipsItem1.User.CreatedAt != nil { - memberships3.User.CreatedAt = types.StringValue(membershipsItem1.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.CreatedAt = types.StringNull() - } - memberships3.User.Email = types.StringPointerValue(membershipsItem1.User.Email) - memberships3.User.ID = types.StringPointerValue(membershipsItem1.User.ID) - memberships3.User.Name = types.StringPointerValue(membershipsItem1.User.Name) - memberships3.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem1.User.SignalsEnabledNotificationTypes { - memberships3.User.SignalsEnabledNotificationTypes = append(memberships3.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships3.User.SlackLinked = types.BoolPointerValue(membershipsItem1.User.SlackLinked) - memberships3.User.SlackUserID = types.StringPointerValue(membershipsItem1.User.SlackUserID) - if membershipsItem1.User.UpdatedAt != nil { - memberships3.User.UpdatedAt = types.StringValue(membershipsItem1.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount1+1 > len(r.Owner.Memberships) { - r.Owner.Memberships = append(r.Owner.Memberships, memberships3) - } else { - r.Owner.Memberships[membershipsCount1].DefaultIncidentRole = memberships3.DefaultIncidentRole - r.Owner.Memberships[membershipsCount1].Schedule = memberships3.Schedule - r.Owner.Memberships[membershipsCount1].User = memberships3.User - } - } - if resp.Owner.MsTeamsChannel == nil { - r.Owner.MsTeamsChannel = nil - } else { - r.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelID) - r.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelName) - r.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelURL) - r.Owner.MsTeamsChannel.ID = types.StringPointerValue(resp.Owner.MsTeamsChannel.ID) - r.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.Owner.MsTeamsChannel.MsTeamID) - r.Owner.MsTeamsChannel.Status = types.StringPointerValue(resp.Owner.MsTeamsChannel.Status) - r.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(resp.Owner.MsTeamsChannel.TeamName) - } - r.Owner.Name = types.StringPointerValue(resp.Owner.Name) - r.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.Owner.OwnedFunctionalities) > len(resp.Owner.OwnedFunctionalities) { - r.Owner.OwnedFunctionalities = r.Owner.OwnedFunctionalities[:len(resp.Owner.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount1, ownedFunctionalitiesItem1 := range resp.Owner.OwnedFunctionalities { - var ownedFunctionalities3 tfTypes.FunctionalityEntity - ownedFunctionalities3.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem1.ActiveIncidents { - ownedFunctionalities3.ActiveIncidents = append(ownedFunctionalities3.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities3.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem1.AlertOnAdd) - ownedFunctionalities3.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem1.AutoAddRespondingTeam) - if ownedFunctionalitiesItem1.CreatedAt != nil { - ownedFunctionalities3.CreatedAt = types.StringValue(ownedFunctionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.CreatedAt = types.StringNull() - } - ownedFunctionalities3.Description = types.StringPointerValue(ownedFunctionalitiesItem1.Description) - ownedFunctionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount5, externalResourcesItem5 := range ownedFunctionalitiesItem1.ExternalResources { - var externalResources11 tfTypes.ExternalResourceEntity - externalResources11.ConnectionID = types.StringPointerValue(externalResourcesItem5.ConnectionID) - externalResources11.ConnectionName = types.StringPointerValue(externalResourcesItem5.ConnectionName) - externalResources11.ConnectionType = types.StringPointerValue(externalResourcesItem5.ConnectionType) - if externalResourcesItem5.CreatedAt != nil { - externalResources11.CreatedAt = types.StringValue(externalResourcesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.CreatedAt = types.StringNull() - } - externalResources11.Name = types.StringPointerValue(externalResourcesItem5.Name) - externalResources11.RemoteID = types.StringPointerValue(externalResourcesItem5.RemoteID) - externalResources11.RemoteURL = types.StringPointerValue(externalResourcesItem5.RemoteURL) - if externalResourcesItem5.UpdatedAt != nil { - externalResources11.UpdatedAt = types.StringValue(externalResourcesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.UpdatedAt = types.StringNull() - } - if externalResourcesCount5+1 > len(ownedFunctionalities3.ExternalResources) { - ownedFunctionalities3.ExternalResources = append(ownedFunctionalities3.ExternalResources, externalResources11) - } else { - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionID = externalResources11.ConnectionID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionName = externalResources11.ConnectionName - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionType = externalResources11.ConnectionType - ownedFunctionalities3.ExternalResources[externalResourcesCount5].CreatedAt = externalResources11.CreatedAt - ownedFunctionalities3.ExternalResources[externalResourcesCount5].Name = externalResources11.Name - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteID = externalResources11.RemoteID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteURL = externalResources11.RemoteURL - ownedFunctionalities3.ExternalResources[externalResourcesCount5].UpdatedAt = externalResources11.UpdatedAt - } - } - ownedFunctionalities3.ID = types.StringPointerValue(ownedFunctionalitiesItem1.ID) - if len(ownedFunctionalitiesItem1.Labels) > 0 { - ownedFunctionalities3.Labels = make(map[string]types.String) - for key5, value6 := range ownedFunctionalitiesItem1.Labels { - ownedFunctionalities3.Labels[key5] = types.StringValue(value6) - } - } - ownedFunctionalities3.Links = []tfTypes.LinksEntity{} - for linksCount5, linksItem5 := range ownedFunctionalitiesItem1.Links { - var links11 tfTypes.LinksEntity - links11.HrefURL = types.StringPointerValue(linksItem5.HrefURL) - links11.IconURL = types.StringPointerValue(linksItem5.IconURL) - links11.ID = types.StringPointerValue(linksItem5.ID) - links11.Name = types.StringPointerValue(linksItem5.Name) - if linksCount5+1 > len(ownedFunctionalities3.Links) { - ownedFunctionalities3.Links = append(ownedFunctionalities3.Links, links11) - } else { - ownedFunctionalities3.Links[linksCount5].HrefURL = links11.HrefURL - ownedFunctionalities3.Links[linksCount5].IconURL = links11.IconURL - ownedFunctionalities3.Links[linksCount5].ID = links11.ID - ownedFunctionalities3.Links[linksCount5].Name = links11.Name - } - } - ownedFunctionalities3.Name = types.StringPointerValue(ownedFunctionalitiesItem1.Name) - if ownedFunctionalitiesItem1.Owner == nil { - ownedFunctionalities3.Owner = nil - } else { - ownedFunctionalities3.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities3.Slug = types.StringPointerValue(ownedFunctionalitiesItem1.Slug) - if ownedFunctionalitiesItem1.UpdatedAt != nil { - ownedFunctionalities3.UpdatedAt = types.StringValue(ownedFunctionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem1.UpdatedBy == nil { - ownedFunctionalities3.UpdatedBy = nil - } else { - ownedFunctionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities3.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Email) - ownedFunctionalities3.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.ID) - ownedFunctionalities3.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Name) - ownedFunctionalities3.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Source) - } - if ownedFunctionalitiesCount1+1 > len(r.Owner.OwnedFunctionalities) { - r.Owner.OwnedFunctionalities = append(r.Owner.OwnedFunctionalities, ownedFunctionalities3) - } else { - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ActiveIncidents = ownedFunctionalities3.ActiveIncidents - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AlertOnAdd = ownedFunctionalities3.AlertOnAdd - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AutoAddRespondingTeam = ownedFunctionalities3.AutoAddRespondingTeam - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].CreatedAt = ownedFunctionalities3.CreatedAt - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Description = ownedFunctionalities3.Description - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ExternalResources = ownedFunctionalities3.ExternalResources - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ID = ownedFunctionalities3.ID - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Labels = ownedFunctionalities3.Labels - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Links = ownedFunctionalities3.Links - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Name = ownedFunctionalities3.Name - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Owner = ownedFunctionalities3.Owner - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Slug = ownedFunctionalities3.Slug - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedAt = ownedFunctionalities3.UpdatedAt - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedBy = ownedFunctionalities3.UpdatedBy - } - } - r.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.Owner.OwnedRunbooks) > len(resp.Owner.OwnedRunbooks) { - r.Owner.OwnedRunbooks = r.Owner.OwnedRunbooks[:len(resp.Owner.OwnedRunbooks)] - } - for ownedRunbooksCount1, ownedRunbooksItem1 := range resp.Owner.OwnedRunbooks { - var ownedRunbooks3 tfTypes.SlimRunbookEntity - if ownedRunbooksItem1.AttachmentRule == nil { - ownedRunbooks3.AttachmentRule = nil - } else { - ownedRunbooks3.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem1.AttachmentRule.Logic == nil { - ownedRunbooks3.AttachmentRule.Logic = nil - } else { - ownedRunbooks3.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem1.AttachmentRule.UserData == nil { - ownedRunbooks3.AttachmentRule.UserData = nil - } else { - ownedRunbooks3.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks3.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Label) - ownedRunbooks3.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Type) - ownedRunbooks3.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Value) - } - } - ownedRunbooks3.Categories = types.StringPointerValue(ownedRunbooksItem1.Categories) - if ownedRunbooksItem1.CreatedAt != nil { - ownedRunbooks3.CreatedAt = types.StringValue(ownedRunbooksItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.CreatedAt = types.StringNull() - } - ownedRunbooks3.Description = types.StringPointerValue(ownedRunbooksItem1.Description) - ownedRunbooks3.ID = types.StringPointerValue(ownedRunbooksItem1.ID) - ownedRunbooks3.Name = types.StringPointerValue(ownedRunbooksItem1.Name) - if ownedRunbooksItem1.Owner == nil { - ownedRunbooks3.Owner = nil - } else { - ownedRunbooks3.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks3.Summary = types.StringPointerValue(ownedRunbooksItem1.Summary) - ownedRunbooks3.Type = types.StringPointerValue(ownedRunbooksItem1.Type) - if ownedRunbooksItem1.UpdatedAt != nil { - ownedRunbooks3.UpdatedAt = types.StringValue(ownedRunbooksItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount1+1 > len(r.Owner.OwnedRunbooks) { - r.Owner.OwnedRunbooks = append(r.Owner.OwnedRunbooks, ownedRunbooks3) - } else { - r.Owner.OwnedRunbooks[ownedRunbooksCount1].AttachmentRule = ownedRunbooks3.AttachmentRule - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Categories = ownedRunbooks3.Categories - r.Owner.OwnedRunbooks[ownedRunbooksCount1].CreatedAt = ownedRunbooks3.CreatedAt - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Description = ownedRunbooks3.Description - r.Owner.OwnedRunbooks[ownedRunbooksCount1].ID = ownedRunbooks3.ID - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Name = ownedRunbooks3.Name - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Owner = ownedRunbooks3.Owner - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Summary = ownedRunbooks3.Summary - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Type = ownedRunbooks3.Type - r.Owner.OwnedRunbooks[ownedRunbooksCount1].UpdatedAt = ownedRunbooks3.UpdatedAt - } - } - r.Owner.SignalsIcalURL = types.StringPointerValue(resp.Owner.SignalsIcalURL) - if resp.Owner.SlackChannel == nil { - r.Owner.SlackChannel = nil - } else { - r.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.Owner.SlackChannel.ID = types.StringPointerValue(resp.Owner.SlackChannel.ID) - r.Owner.SlackChannel.Name = types.StringPointerValue(resp.Owner.SlackChannel.Name) - r.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(resp.Owner.SlackChannel.SlackChannelID) - } - r.Owner.Slug = types.StringPointerValue(resp.Owner.Slug) - if resp.Owner.UpdatedAt != nil { - r.Owner.UpdatedAt = types.StringValue(resp.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Owner.UpdatedAt = types.StringNull() - } - } - if resp.ServiceChecklistUpdatedAt != nil { - r.ServiceChecklistUpdatedAt = types.StringValue(resp.ServiceChecklistUpdatedAt.Format(time.RFC3339Nano)) - } else { - r.ServiceChecklistUpdatedAt = types.StringNull() - } - if resp.ServiceTier != nil { - r.ServiceTier = types.Int64Value(int64(*resp.ServiceTier)) - } else { - r.ServiceTier = types.Int64Null() - } - r.Slug = types.StringPointerValue(resp.Slug) - r.Teams = []tfTypes.TeamEntity{} - if len(r.Teams) > len(resp.Teams) { - r.Teams = r.Teams[:len(resp.Teams)] - } - for teamsCount, teamsItem := range resp.Teams { - var teams1 tfTypes.TeamEntity - if teamsItem.CreatedAt != nil { - teams1.CreatedAt = types.StringValue(teamsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams1.CreatedAt = types.StringNull() - } - if teamsItem.CreatedBy == nil { - teams1.CreatedBy = nil - } else { - teams1.CreatedBy = &tfTypes.AuthorEntity{} - teams1.CreatedBy.Email = types.StringPointerValue(teamsItem.CreatedBy.Email) - teams1.CreatedBy.ID = types.StringPointerValue(teamsItem.CreatedBy.ID) - teams1.CreatedBy.Name = types.StringPointerValue(teamsItem.CreatedBy.Name) - teams1.CreatedBy.Source = types.StringPointerValue(teamsItem.CreatedBy.Source) - } - teams1.Description = types.StringPointerValue(teamsItem.Description) - teams1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount3, functionalitiesItem3 := range teamsItem.Functionalities { - var functionalities7 tfTypes.FunctionalityEntity - functionalities7.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem3.ActiveIncidents { - functionalities7.ActiveIncidents = append(functionalities7.ActiveIncidents, types.StringValue(v)) - } - functionalities7.AlertOnAdd = types.BoolPointerValue(functionalitiesItem3.AlertOnAdd) - functionalities7.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem3.AutoAddRespondingTeam) - if functionalitiesItem3.CreatedAt != nil { - functionalities7.CreatedAt = types.StringValue(functionalitiesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.CreatedAt = types.StringNull() - } - functionalities7.Description = types.StringPointerValue(functionalitiesItem3.Description) - functionalities7.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount6, externalResourcesItem6 := range functionalitiesItem3.ExternalResources { - var externalResources13 tfTypes.ExternalResourceEntity - externalResources13.ConnectionID = types.StringPointerValue(externalResourcesItem6.ConnectionID) - externalResources13.ConnectionName = types.StringPointerValue(externalResourcesItem6.ConnectionName) - externalResources13.ConnectionType = types.StringPointerValue(externalResourcesItem6.ConnectionType) - if externalResourcesItem6.CreatedAt != nil { - externalResources13.CreatedAt = types.StringValue(externalResourcesItem6.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.CreatedAt = types.StringNull() - } - externalResources13.Name = types.StringPointerValue(externalResourcesItem6.Name) - externalResources13.RemoteID = types.StringPointerValue(externalResourcesItem6.RemoteID) - externalResources13.RemoteURL = types.StringPointerValue(externalResourcesItem6.RemoteURL) - if externalResourcesItem6.UpdatedAt != nil { - externalResources13.UpdatedAt = types.StringValue(externalResourcesItem6.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.UpdatedAt = types.StringNull() - } - if externalResourcesCount6+1 > len(functionalities7.ExternalResources) { - functionalities7.ExternalResources = append(functionalities7.ExternalResources, externalResources13) - } else { - functionalities7.ExternalResources[externalResourcesCount6].ConnectionID = externalResources13.ConnectionID - functionalities7.ExternalResources[externalResourcesCount6].ConnectionName = externalResources13.ConnectionName - functionalities7.ExternalResources[externalResourcesCount6].ConnectionType = externalResources13.ConnectionType - functionalities7.ExternalResources[externalResourcesCount6].CreatedAt = externalResources13.CreatedAt - functionalities7.ExternalResources[externalResourcesCount6].Name = externalResources13.Name - functionalities7.ExternalResources[externalResourcesCount6].RemoteID = externalResources13.RemoteID - functionalities7.ExternalResources[externalResourcesCount6].RemoteURL = externalResources13.RemoteURL - functionalities7.ExternalResources[externalResourcesCount6].UpdatedAt = externalResources13.UpdatedAt - } - } - functionalities7.ID = types.StringPointerValue(functionalitiesItem3.ID) - if len(functionalitiesItem3.Labels) > 0 { - functionalities7.Labels = make(map[string]types.String) - for key6, value8 := range functionalitiesItem3.Labels { - functionalities7.Labels[key6] = types.StringValue(value8) - } - } - functionalities7.Links = []tfTypes.LinksEntity{} - for linksCount6, linksItem6 := range functionalitiesItem3.Links { - var links13 tfTypes.LinksEntity - links13.HrefURL = types.StringPointerValue(linksItem6.HrefURL) - links13.IconURL = types.StringPointerValue(linksItem6.IconURL) - links13.ID = types.StringPointerValue(linksItem6.ID) - links13.Name = types.StringPointerValue(linksItem6.Name) - if linksCount6+1 > len(functionalities7.Links) { - functionalities7.Links = append(functionalities7.Links, links13) - } else { - functionalities7.Links[linksCount6].HrefURL = links13.HrefURL - functionalities7.Links[linksCount6].IconURL = links13.IconURL - functionalities7.Links[linksCount6].ID = links13.ID - functionalities7.Links[linksCount6].Name = links13.Name - } - } - functionalities7.Name = types.StringPointerValue(functionalitiesItem3.Name) - if functionalitiesItem3.Owner == nil { - functionalities7.Owner = nil - } else { - functionalities7.Owner = &tfTypes.TeamEntity1{} - } - functionalities7.Slug = types.StringPointerValue(functionalitiesItem3.Slug) - if functionalitiesItem3.UpdatedAt != nil { - functionalities7.UpdatedAt = types.StringValue(functionalitiesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.UpdatedAt = types.StringNull() - } - if functionalitiesItem3.UpdatedBy == nil { - functionalities7.UpdatedBy = nil - } else { - functionalities7.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities7.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Email) - functionalities7.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem3.UpdatedBy.ID) - functionalities7.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Name) - functionalities7.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Source) - } - if functionalitiesCount3+1 > len(teams1.Functionalities) { - teams1.Functionalities = append(teams1.Functionalities, functionalities7) - } else { - teams1.Functionalities[functionalitiesCount3].ActiveIncidents = functionalities7.ActiveIncidents - teams1.Functionalities[functionalitiesCount3].AlertOnAdd = functionalities7.AlertOnAdd - teams1.Functionalities[functionalitiesCount3].AutoAddRespondingTeam = functionalities7.AutoAddRespondingTeam - teams1.Functionalities[functionalitiesCount3].CreatedAt = functionalities7.CreatedAt - teams1.Functionalities[functionalitiesCount3].Description = functionalities7.Description - teams1.Functionalities[functionalitiesCount3].ExternalResources = functionalities7.ExternalResources - teams1.Functionalities[functionalitiesCount3].ID = functionalities7.ID - teams1.Functionalities[functionalitiesCount3].Labels = functionalities7.Labels - teams1.Functionalities[functionalitiesCount3].Links = functionalities7.Links - teams1.Functionalities[functionalitiesCount3].Name = functionalities7.Name - teams1.Functionalities[functionalitiesCount3].Owner = functionalities7.Owner - teams1.Functionalities[functionalitiesCount3].Slug = functionalities7.Slug - teams1.Functionalities[functionalitiesCount3].UpdatedAt = functionalities7.UpdatedAt - teams1.Functionalities[functionalitiesCount3].UpdatedBy = functionalities7.UpdatedBy - } - } - teams1.ID = types.StringPointerValue(teamsItem.ID) - teams1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount2, membershipsItem2 := range teamsItem.Memberships { - var memberships5 tfTypes.MembershipEntity - if membershipsItem2.DefaultIncidentRole == nil { - memberships5.DefaultIncidentRole = nil - } else { - memberships5.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem2.DefaultIncidentRole.CreatedAt != nil { - memberships5.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Description) - if membershipsItem2.DefaultIncidentRole.DiscardedAt != nil { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.ID) - memberships5.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Name) - memberships5.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Summary) - if membershipsItem2.DefaultIncidentRole.UpdatedAt != nil { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem2.Schedule == nil { - memberships5.Schedule = nil - } else { - memberships5.Schedule = &tfTypes.ScheduleEntity{} - memberships5.Schedule.Discarded = types.BoolPointerValue(membershipsItem2.Schedule.Discarded) - memberships5.Schedule.ID = types.StringPointerValue(membershipsItem2.Schedule.ID) - memberships5.Schedule.Integration = types.StringPointerValue(membershipsItem2.Schedule.Integration) - memberships5.Schedule.Name = types.StringPointerValue(membershipsItem2.Schedule.Name) - } - if membershipsItem2.User == nil { - memberships5.User = nil - } else { - memberships5.User = &tfTypes.UserEntity{} - if membershipsItem2.User.CreatedAt != nil { - memberships5.User.CreatedAt = types.StringValue(membershipsItem2.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.CreatedAt = types.StringNull() - } - memberships5.User.Email = types.StringPointerValue(membershipsItem2.User.Email) - memberships5.User.ID = types.StringPointerValue(membershipsItem2.User.ID) - memberships5.User.Name = types.StringPointerValue(membershipsItem2.User.Name) - memberships5.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem2.User.SignalsEnabledNotificationTypes { - memberships5.User.SignalsEnabledNotificationTypes = append(memberships5.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships5.User.SlackLinked = types.BoolPointerValue(membershipsItem2.User.SlackLinked) - memberships5.User.SlackUserID = types.StringPointerValue(membershipsItem2.User.SlackUserID) - if membershipsItem2.User.UpdatedAt != nil { - memberships5.User.UpdatedAt = types.StringValue(membershipsItem2.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount2+1 > len(teams1.Memberships) { - teams1.Memberships = append(teams1.Memberships, memberships5) - } else { - teams1.Memberships[membershipsCount2].DefaultIncidentRole = memberships5.DefaultIncidentRole - teams1.Memberships[membershipsCount2].Schedule = memberships5.Schedule - teams1.Memberships[membershipsCount2].User = memberships5.User - } - } - if teamsItem.MsTeamsChannel == nil { - teams1.MsTeamsChannel = nil - } else { - teams1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams1.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelID) - teams1.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelName) - teams1.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelURL) - teams1.MsTeamsChannel.ID = types.StringPointerValue(teamsItem.MsTeamsChannel.ID) - teams1.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem.MsTeamsChannel.MsTeamID) - teams1.MsTeamsChannel.Status = types.StringPointerValue(teamsItem.MsTeamsChannel.Status) - teams1.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem.MsTeamsChannel.TeamName) - } - teams1.Name = types.StringPointerValue(teamsItem.Name) - teams1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount2, ownedFunctionalitiesItem2 := range teamsItem.OwnedFunctionalities { - var ownedFunctionalities5 tfTypes.FunctionalityEntity - ownedFunctionalities5.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem2.ActiveIncidents { - ownedFunctionalities5.ActiveIncidents = append(ownedFunctionalities5.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities5.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem2.AlertOnAdd) - ownedFunctionalities5.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem2.AutoAddRespondingTeam) - if ownedFunctionalitiesItem2.CreatedAt != nil { - ownedFunctionalities5.CreatedAt = types.StringValue(ownedFunctionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.CreatedAt = types.StringNull() - } - ownedFunctionalities5.Description = types.StringPointerValue(ownedFunctionalitiesItem2.Description) - ownedFunctionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount7, externalResourcesItem7 := range ownedFunctionalitiesItem2.ExternalResources { - var externalResources15 tfTypes.ExternalResourceEntity - externalResources15.ConnectionID = types.StringPointerValue(externalResourcesItem7.ConnectionID) - externalResources15.ConnectionName = types.StringPointerValue(externalResourcesItem7.ConnectionName) - externalResources15.ConnectionType = types.StringPointerValue(externalResourcesItem7.ConnectionType) - if externalResourcesItem7.CreatedAt != nil { - externalResources15.CreatedAt = types.StringValue(externalResourcesItem7.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.CreatedAt = types.StringNull() - } - externalResources15.Name = types.StringPointerValue(externalResourcesItem7.Name) - externalResources15.RemoteID = types.StringPointerValue(externalResourcesItem7.RemoteID) - externalResources15.RemoteURL = types.StringPointerValue(externalResourcesItem7.RemoteURL) - if externalResourcesItem7.UpdatedAt != nil { - externalResources15.UpdatedAt = types.StringValue(externalResourcesItem7.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.UpdatedAt = types.StringNull() - } - if externalResourcesCount7+1 > len(ownedFunctionalities5.ExternalResources) { - ownedFunctionalities5.ExternalResources = append(ownedFunctionalities5.ExternalResources, externalResources15) - } else { - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionID = externalResources15.ConnectionID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionName = externalResources15.ConnectionName - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionType = externalResources15.ConnectionType - ownedFunctionalities5.ExternalResources[externalResourcesCount7].CreatedAt = externalResources15.CreatedAt - ownedFunctionalities5.ExternalResources[externalResourcesCount7].Name = externalResources15.Name - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteID = externalResources15.RemoteID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteURL = externalResources15.RemoteURL - ownedFunctionalities5.ExternalResources[externalResourcesCount7].UpdatedAt = externalResources15.UpdatedAt - } - } - ownedFunctionalities5.ID = types.StringPointerValue(ownedFunctionalitiesItem2.ID) - if len(ownedFunctionalitiesItem2.Labels) > 0 { - ownedFunctionalities5.Labels = make(map[string]types.String) - for key7, value9 := range ownedFunctionalitiesItem2.Labels { - ownedFunctionalities5.Labels[key7] = types.StringValue(value9) - } - } - ownedFunctionalities5.Links = []tfTypes.LinksEntity{} - for linksCount7, linksItem7 := range ownedFunctionalitiesItem2.Links { - var links15 tfTypes.LinksEntity - links15.HrefURL = types.StringPointerValue(linksItem7.HrefURL) - links15.IconURL = types.StringPointerValue(linksItem7.IconURL) - links15.ID = types.StringPointerValue(linksItem7.ID) - links15.Name = types.StringPointerValue(linksItem7.Name) - if linksCount7+1 > len(ownedFunctionalities5.Links) { - ownedFunctionalities5.Links = append(ownedFunctionalities5.Links, links15) - } else { - ownedFunctionalities5.Links[linksCount7].HrefURL = links15.HrefURL - ownedFunctionalities5.Links[linksCount7].IconURL = links15.IconURL - ownedFunctionalities5.Links[linksCount7].ID = links15.ID - ownedFunctionalities5.Links[linksCount7].Name = links15.Name - } - } - ownedFunctionalities5.Name = types.StringPointerValue(ownedFunctionalitiesItem2.Name) - if ownedFunctionalitiesItem2.Owner == nil { - ownedFunctionalities5.Owner = nil - } else { - ownedFunctionalities5.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities5.Slug = types.StringPointerValue(ownedFunctionalitiesItem2.Slug) - if ownedFunctionalitiesItem2.UpdatedAt != nil { - ownedFunctionalities5.UpdatedAt = types.StringValue(ownedFunctionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem2.UpdatedBy == nil { - ownedFunctionalities5.UpdatedBy = nil - } else { - ownedFunctionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities5.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Email) - ownedFunctionalities5.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.ID) - ownedFunctionalities5.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Name) - ownedFunctionalities5.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Source) - } - if ownedFunctionalitiesCount2+1 > len(teams1.OwnedFunctionalities) { - teams1.OwnedFunctionalities = append(teams1.OwnedFunctionalities, ownedFunctionalities5) - } else { - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ActiveIncidents = ownedFunctionalities5.ActiveIncidents - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AlertOnAdd = ownedFunctionalities5.AlertOnAdd - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AutoAddRespondingTeam = ownedFunctionalities5.AutoAddRespondingTeam - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].CreatedAt = ownedFunctionalities5.CreatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Description = ownedFunctionalities5.Description - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ExternalResources = ownedFunctionalities5.ExternalResources - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ID = ownedFunctionalities5.ID - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Labels = ownedFunctionalities5.Labels - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Links = ownedFunctionalities5.Links - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Name = ownedFunctionalities5.Name - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Owner = ownedFunctionalities5.Owner - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Slug = ownedFunctionalities5.Slug - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedAt = ownedFunctionalities5.UpdatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedBy = ownedFunctionalities5.UpdatedBy - } - } - teams1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount2, ownedRunbooksItem2 := range teamsItem.OwnedRunbooks { - var ownedRunbooks5 tfTypes.SlimRunbookEntity - if ownedRunbooksItem2.AttachmentRule == nil { - ownedRunbooks5.AttachmentRule = nil - } else { - ownedRunbooks5.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem2.AttachmentRule.Logic == nil { - ownedRunbooks5.AttachmentRule.Logic = nil - } else { - ownedRunbooks5.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem2.AttachmentRule.UserData == nil { - ownedRunbooks5.AttachmentRule.UserData = nil - } else { - ownedRunbooks5.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks5.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Label) - ownedRunbooks5.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Type) - ownedRunbooks5.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Value) - } - } - ownedRunbooks5.Categories = types.StringPointerValue(ownedRunbooksItem2.Categories) - if ownedRunbooksItem2.CreatedAt != nil { - ownedRunbooks5.CreatedAt = types.StringValue(ownedRunbooksItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.CreatedAt = types.StringNull() - } - ownedRunbooks5.Description = types.StringPointerValue(ownedRunbooksItem2.Description) - ownedRunbooks5.ID = types.StringPointerValue(ownedRunbooksItem2.ID) - ownedRunbooks5.Name = types.StringPointerValue(ownedRunbooksItem2.Name) - if ownedRunbooksItem2.Owner == nil { - ownedRunbooks5.Owner = nil - } else { - ownedRunbooks5.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks5.Summary = types.StringPointerValue(ownedRunbooksItem2.Summary) - ownedRunbooks5.Type = types.StringPointerValue(ownedRunbooksItem2.Type) - if ownedRunbooksItem2.UpdatedAt != nil { - ownedRunbooks5.UpdatedAt = types.StringValue(ownedRunbooksItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount2+1 > len(teams1.OwnedRunbooks) { - teams1.OwnedRunbooks = append(teams1.OwnedRunbooks, ownedRunbooks5) - } else { - teams1.OwnedRunbooks[ownedRunbooksCount2].AttachmentRule = ownedRunbooks5.AttachmentRule - teams1.OwnedRunbooks[ownedRunbooksCount2].Categories = ownedRunbooks5.Categories - teams1.OwnedRunbooks[ownedRunbooksCount2].CreatedAt = ownedRunbooks5.CreatedAt - teams1.OwnedRunbooks[ownedRunbooksCount2].Description = ownedRunbooks5.Description - teams1.OwnedRunbooks[ownedRunbooksCount2].ID = ownedRunbooks5.ID - teams1.OwnedRunbooks[ownedRunbooksCount2].Name = ownedRunbooks5.Name - teams1.OwnedRunbooks[ownedRunbooksCount2].Owner = ownedRunbooks5.Owner - teams1.OwnedRunbooks[ownedRunbooksCount2].Summary = ownedRunbooks5.Summary - teams1.OwnedRunbooks[ownedRunbooksCount2].Type = ownedRunbooks5.Type - teams1.OwnedRunbooks[ownedRunbooksCount2].UpdatedAt = ownedRunbooks5.UpdatedAt - } - } - teams1.SignalsIcalURL = types.StringPointerValue(teamsItem.SignalsIcalURL) - if teamsItem.SlackChannel == nil { - teams1.SlackChannel = nil - } else { - teams1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams1.SlackChannel.ID = types.StringPointerValue(teamsItem.SlackChannel.ID) - teams1.SlackChannel.Name = types.StringPointerValue(teamsItem.SlackChannel.Name) - teams1.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem.SlackChannel.SlackChannelID) - } - teams1.Slug = types.StringPointerValue(teamsItem.Slug) - if teamsItem.UpdatedAt != nil { - teams1.UpdatedAt = types.StringValue(teamsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams1.UpdatedAt = types.StringNull() - } - if teamsCount+1 > len(r.Teams) { - r.Teams = append(r.Teams, teams1) - } else { - r.Teams[teamsCount].CreatedAt = teams1.CreatedAt - r.Teams[teamsCount].CreatedBy = teams1.CreatedBy - r.Teams[teamsCount].Description = teams1.Description - r.Teams[teamsCount].Functionalities = teams1.Functionalities - r.Teams[teamsCount].ID = teams1.ID - r.Teams[teamsCount].Memberships = teams1.Memberships - r.Teams[teamsCount].MsTeamsChannel = teams1.MsTeamsChannel - r.Teams[teamsCount].Name = teams1.Name - r.Teams[teamsCount].OwnedFunctionalities = teams1.OwnedFunctionalities - r.Teams[teamsCount].OwnedRunbooks = teams1.OwnedRunbooks - r.Teams[teamsCount].SignalsIcalURL = teams1.SignalsIcalURL - r.Teams[teamsCount].SlackChannel = teams1.SlackChannel - r.Teams[teamsCount].Slug = teams1.Slug - r.Teams[teamsCount].UpdatedAt = teams1.UpdatedAt - } - } - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - if resp.UpdatedBy == nil { - r.UpdatedBy = nil - } else { - r.UpdatedBy = &tfTypes.AuthorEntity{} - r.UpdatedBy.Email = types.StringPointerValue(resp.UpdatedBy.Email) - r.UpdatedBy.ID = types.StringPointerValue(resp.UpdatedBy.ID) - r.UpdatedBy.Name = types.StringPointerValue(resp.UpdatedBy.Name) - r.UpdatedBy.Source = types.StringPointerValue(resp.UpdatedBy.Source) - } - } -} diff --git a/internal/provider/service_resource.go b/internal/provider/service_resource.go deleted file mode 100644 index 33c58df..0000000 --- a/internal/provider/service_resource.go +++ /dev/null @@ -1,2301 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - speakeasy_objectvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/objectvalidators" - speakeasy_stringvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/stringvalidators" - "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &ServiceResource{} -var _ resource.ResourceWithImportState = &ServiceResource{} - -func NewServiceResource() resource.Resource { - return &ServiceResource{} -} - -// ServiceResource defines the resource implementation. -type ServiceResource struct { - client *sdk.Firehydrant -} - -// ServiceResourceModel describes the resource data model. -type ServiceResourceModel struct { - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AllowedParams []types.String `tfsdk:"allowed_params"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - Checklists []tfTypes.Checklists `tfsdk:"checklists"` - CompletedChecks types.Int64 `tfsdk:"completed_checks"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []tfTypes.ExternalResourceEntity1 `tfsdk:"external_resources"` - Functionalities []tfTypes.Functionalities `tfsdk:"functionalities"` - ID types.String `tfsdk:"id"` - Labels map[string]types.String `tfsdk:"labels"` - LastImport *tfTypes.ImportsImportableResourceEntity `tfsdk:"last_import"` - Links []tfTypes.LinksEntity1 `tfsdk:"links"` - ManagedBy types.String `tfsdk:"managed_by"` - ManagedBySettings *tfTypes.TeamEntity1 `tfsdk:"managed_by_settings"` - Name types.String `tfsdk:"name"` - Owner *tfTypes.Owner `tfsdk:"owner"` - ServiceChecklistUpdatedAt types.String `tfsdk:"service_checklist_updated_at"` - ServiceTier types.Int64 `tfsdk:"service_tier"` - Slug types.String `tfsdk:"slug"` - Teams []tfTypes.Owner `tfsdk:"teams"` - UpdatedAt types.String `tfsdk:"updated_at"` - UpdatedBy *tfTypes.AuthorEntity `tfsdk:"updated_by"` -} - -func (r *ServiceResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_service" -} - -func (r *ServiceResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Service Resource", - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - Optional: true, - }, - "allowed_params": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - Optional: true, - }, - "checklists": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `List of checklists associated with a service`, - }, - "completed_checks": schema.Int64Attribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `The integration slug for the external resource. Can be one of: github, opsgenie, pager_duty, victorops. Not required if the resource has already been imported.`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `An array of external resources to attach to this service.`, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `If you are trying to reuse a functionality, you may set the ID to attach it to the service`, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `If you are trying to create a new functionality and attach it to this service, set the summary key`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - Description: `An array of functionalities`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Description: `A hash of label keys and values`, - }, - "last_import": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "import_errors": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "data": schema.SingleNestedAttribute{ - Computed: true, - Description: `Additional error data`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "resource": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Computed: true, - }, - "resource_id": schema.StringAttribute{ - Computed: true, - }, - "resource_type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "imported_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["selected", "skipped", "imported", "errored"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "selected", - "skipped", - "imported", - "errored", - ), - }, - }, - }, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `URL. Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `An optional URL to an icon representing this link`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Short name used to display and identify this link. Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - }, - }, - Description: `An array of links to associate with this service`, - }, - "managed_by": schema.StringAttribute{ - Computed: true, - Description: `If set, this field indicates that the service is managed by an integration and thus cannot be set manually`, - }, - "managed_by_settings": schema.SingleNestedAttribute{ - Computed: true, - Description: `Indicates the settings of the catalog that manages this service`, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `An object representing a Team that owns the service`, - }, - "service_checklist_updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "service_tier": schema.Int64Attribute{ - Computed: true, - Optional: true, - Description: `Integer representing service tier. Lower values represent higher criticality. If not specified the default value will be 5. must be one of ["0", "1", "2", "3", "4", "5"]`, - Validators: []validator.Int64{ - int64validator.OneOf( - 0, - 1, - 2, - 3, - 4, - 5, - ), - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `An array of teams to attach to this service.`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - } -} - -func (r *ServiceResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *ServiceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *ServiceResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1Services() - res, err := r.client.Services.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceEntity(res.ServiceEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var serviceID string - serviceID = data.ID.ValueString() - - request1 := operations.GetV1ServicesServiceIDRequest{ - ServiceID: serviceID, - } - res1, err := r.client.Services.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.ServiceEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedServiceEntity(res1.ServiceEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ServiceResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *ServiceResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var serviceID string - serviceID = data.ID.ValueString() - - request := operations.GetV1ServicesServiceIDRequest{ - ServiceID: serviceID, - } - res, err := r.client.Services.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceEntity(res.ServiceEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ServiceResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *ServiceResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var serviceID string - serviceID = data.ID.ValueString() - - patchV1ServicesServiceID := *data.ToSharedPatchV1ServicesServiceID() - request := operations.PatchV1ServicesServiceIDRequest{ - ServiceID: serviceID, - PatchV1ServicesServiceID: patchV1ServicesServiceID, - } - res, err := r.client.Services.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceEntity(res.ServiceEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var serviceId1 string - serviceId1 = data.ID.ValueString() - - request1 := operations.GetV1ServicesServiceIDRequest{ - ServiceID: serviceId1, - } - res1, err := r.client.Services.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.ServiceEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedServiceEntity(res1.ServiceEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ServiceResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *ServiceResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var serviceID string - serviceID = data.ID.ValueString() - - request := operations.DeleteV1ServicesServiceIDRequest{ - ServiceID: serviceID, - } - res, err := r.client.Services.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *ServiceResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/service_resource_sdk.go b/internal/provider/service_resource_sdk.go deleted file mode 100644 index 75c3e10..0000000 --- a/internal/provider/service_resource_sdk.go +++ /dev/null @@ -1,1838 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *ServiceResourceModel) ToSharedPostV1Services() *shared.PostV1Services { - var name string - name = r.Name.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - labels := make(map[string]string) - for labelsKey, labelsValue := range r.Labels { - var labelsInst string - labelsInst = labelsValue.ValueString() - - labels[labelsKey] = labelsInst - } - serviceTier := new(shared.ServiceTier) - if !r.ServiceTier.IsUnknown() && !r.ServiceTier.IsNull() { - *serviceTier = shared.ServiceTier(r.ServiceTier.ValueInt64()) - } else { - serviceTier = nil - } - var functionalities []shared.Functionalities = []shared.Functionalities{} - for _, functionalitiesItem := range r.Functionalities { - summary := new(string) - if !functionalitiesItem.Summary.IsUnknown() && !functionalitiesItem.Summary.IsNull() { - *summary = functionalitiesItem.Summary.ValueString() - } else { - summary = nil - } - id := new(string) - if !functionalitiesItem.ID.IsUnknown() && !functionalitiesItem.ID.IsNull() { - *id = functionalitiesItem.ID.ValueString() - } else { - id = nil - } - functionalities = append(functionalities, shared.Functionalities{ - Summary: summary, - ID: id, - }) - } - var links []shared.Links = []shared.Links{} - for _, linksItem := range r.Links { - var name1 string - name1 = linksItem.Name.ValueString() - - var hrefURL string - hrefURL = linksItem.HrefURL.ValueString() - - iconURL := new(string) - if !linksItem.IconURL.IsUnknown() && !linksItem.IconURL.IsNull() { - *iconURL = linksItem.IconURL.ValueString() - } else { - iconURL = nil - } - links = append(links, shared.Links{ - Name: name1, - HrefURL: hrefURL, - IconURL: iconURL, - }) - } - var owner *shared.Owner - if r.Owner != nil { - var id1 string - id1 = r.Owner.ID.ValueString() - - owner = &shared.Owner{ - ID: id1, - } - } - var teams []shared.Teams = []shared.Teams{} - for _, teamsItem := range r.Teams { - var id2 string - id2 = teamsItem.ID.ValueString() - - teams = append(teams, shared.Teams{ - ID: id2, - }) - } - alertOnAdd := new(bool) - if !r.AlertOnAdd.IsUnknown() && !r.AlertOnAdd.IsNull() { - *alertOnAdd = r.AlertOnAdd.ValueBool() - } else { - alertOnAdd = nil - } - autoAddRespondingTeam := new(bool) - if !r.AutoAddRespondingTeam.IsUnknown() && !r.AutoAddRespondingTeam.IsNull() { - *autoAddRespondingTeam = r.AutoAddRespondingTeam.ValueBool() - } else { - autoAddRespondingTeam = nil - } - var externalResources []shared.ExternalResources = []shared.ExternalResources{} - for _, externalResourcesItem := range r.ExternalResources { - var remoteID string - remoteID = externalResourcesItem.RemoteID.ValueString() - - connectionType := new(string) - if !externalResourcesItem.ConnectionType.IsUnknown() && !externalResourcesItem.ConnectionType.IsNull() { - *connectionType = externalResourcesItem.ConnectionType.ValueString() - } else { - connectionType = nil - } - externalResources = append(externalResources, shared.ExternalResources{ - RemoteID: remoteID, - ConnectionType: connectionType, - }) - } - out := shared.PostV1Services{ - Name: name, - Description: description, - Labels: labels, - ServiceTier: serviceTier, - Functionalities: functionalities, - Links: links, - Owner: owner, - Teams: teams, - AlertOnAdd: alertOnAdd, - AutoAddRespondingTeam: autoAddRespondingTeam, - ExternalResources: externalResources, - } - return &out -} - -func (r *ServiceResourceModel) RefreshFromSharedServiceEntity(resp *shared.ServiceEntity) { - if resp != nil { - r.ActiveIncidents = []types.String{} - for _, v := range resp.ActiveIncidents { - r.ActiveIncidents = append(r.ActiveIncidents, types.StringValue(v)) - } - r.AlertOnAdd = types.BoolPointerValue(resp.AlertOnAdd) - r.AllowedParams = []types.String{} - for _, v := range resp.AllowedParams { - r.AllowedParams = append(r.AllowedParams, types.StringValue(v)) - } - r.AutoAddRespondingTeam = types.BoolPointerValue(resp.AutoAddRespondingTeam) - r.Checklists = []tfTypes.Checklists{} - if len(r.Checklists) > len(resp.Checklists) { - r.Checklists = r.Checklists[:len(resp.Checklists)] - } - for checklistsCount, checklistsItem := range resp.Checklists { - var checklists1 tfTypes.Checklists - checklists1.Checks = []tfTypes.ChecklistCheckEntity{} - for checksCount, checksItem := range checklistsItem.Checks { - var checks1 tfTypes.ChecklistCheckEntity - checks1.Description = types.StringPointerValue(checksItem.Description) - checks1.ID = types.StringPointerValue(checksItem.ID) - checks1.Name = types.StringPointerValue(checksItem.Name) - checks1.Status = types.BoolPointerValue(checksItem.Status) - if checksCount+1 > len(checklists1.Checks) { - checklists1.Checks = append(checklists1.Checks, checks1) - } else { - checklists1.Checks[checksCount].Description = checks1.Description - checklists1.Checks[checksCount].ID = checks1.ID - checklists1.Checks[checksCount].Name = checks1.Name - checklists1.Checks[checksCount].Status = checks1.Status - } - } - checklists1.CreatedAt = types.StringPointerValue(checklistsItem.CreatedAt) - checklists1.Description = types.StringPointerValue(checklistsItem.Description) - checklists1.ID = types.StringPointerValue(checklistsItem.ID) - checklists1.Name = types.StringPointerValue(checklistsItem.Name) - if checklistsItem.Owner == nil { - checklists1.Owner = nil - } else { - checklists1.Owner = &tfTypes.TeamEntity{} - if checklistsItem.Owner.CreatedAt != nil { - checklists1.Owner.CreatedAt = types.StringValue(checklistsItem.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.CreatedAt = types.StringNull() - } - if checklistsItem.Owner.CreatedBy == nil { - checklists1.Owner.CreatedBy = nil - } else { - checklists1.Owner.CreatedBy = &tfTypes.AuthorEntity{} - checklists1.Owner.CreatedBy.Email = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Email) - checklists1.Owner.CreatedBy.ID = types.StringPointerValue(checklistsItem.Owner.CreatedBy.ID) - checklists1.Owner.CreatedBy.Name = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Name) - checklists1.Owner.CreatedBy.Source = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Source) - } - checklists1.Owner.Description = types.StringPointerValue(checklistsItem.Owner.Description) - checklists1.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount, functionalitiesItem := range checklistsItem.Owner.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(checklists1.Owner.Functionalities) { - checklists1.Owner.Functionalities = append(checklists1.Owner.Functionalities, functionalities1) - } else { - checklists1.Owner.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - checklists1.Owner.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - checklists1.Owner.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - checklists1.Owner.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - checklists1.Owner.Functionalities[functionalitiesCount].Description = functionalities1.Description - checklists1.Owner.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - checklists1.Owner.Functionalities[functionalitiesCount].ID = functionalities1.ID - checklists1.Owner.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - checklists1.Owner.Functionalities[functionalitiesCount].Links = functionalities1.Links - checklists1.Owner.Functionalities[functionalitiesCount].Name = functionalities1.Name - checklists1.Owner.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - checklists1.Owner.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - checklists1.Owner.ID = types.StringPointerValue(checklistsItem.Owner.ID) - checklists1.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range checklistsItem.Owner.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(checklists1.Owner.Memberships) { - checklists1.Owner.Memberships = append(checklists1.Owner.Memberships, memberships1) - } else { - checklists1.Owner.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - checklists1.Owner.Memberships[membershipsCount].Schedule = memberships1.Schedule - checklists1.Owner.Memberships[membershipsCount].User = memberships1.User - } - } - if checklistsItem.Owner.MsTeamsChannel == nil { - checklists1.Owner.MsTeamsChannel = nil - } else { - checklists1.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - checklists1.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelID) - checklists1.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelName) - checklists1.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelURL) - checklists1.Owner.MsTeamsChannel.ID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ID) - checklists1.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.MsTeamID) - checklists1.Owner.MsTeamsChannel.Status = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.Status) - checklists1.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.TeamName) - } - checklists1.Owner.Name = types.StringPointerValue(checklistsItem.Owner.Name) - checklists1.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range checklistsItem.Owner.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(checklists1.Owner.OwnedFunctionalities) { - checklists1.Owner.OwnedFunctionalities = append(checklists1.Owner.OwnedFunctionalities, ownedFunctionalities1) - } else { - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - checklists1.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range checklistsItem.Owner.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(checklists1.Owner.OwnedRunbooks) { - checklists1.Owner.OwnedRunbooks = append(checklists1.Owner.OwnedRunbooks, ownedRunbooks1) - } else { - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - checklists1.Owner.SignalsIcalURL = types.StringPointerValue(checklistsItem.Owner.SignalsIcalURL) - if checklistsItem.Owner.SlackChannel == nil { - checklists1.Owner.SlackChannel = nil - } else { - checklists1.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - checklists1.Owner.SlackChannel.ID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.ID) - checklists1.Owner.SlackChannel.Name = types.StringPointerValue(checklistsItem.Owner.SlackChannel.Name) - checklists1.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.SlackChannelID) - } - checklists1.Owner.Slug = types.StringPointerValue(checklistsItem.Owner.Slug) - if checklistsItem.Owner.UpdatedAt != nil { - checklists1.Owner.UpdatedAt = types.StringValue(checklistsItem.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.UpdatedAt = types.StringNull() - } - } - if checklistsItem.UpdatedAt != nil { - checklists1.UpdatedAt = types.StringValue(checklistsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.UpdatedAt = types.StringNull() - } - if checklistsCount+1 > len(r.Checklists) { - r.Checklists = append(r.Checklists, checklists1) - } else { - r.Checklists[checklistsCount].Checks = checklists1.Checks - r.Checklists[checklistsCount].CreatedAt = checklists1.CreatedAt - r.Checklists[checklistsCount].Description = checklists1.Description - r.Checklists[checklistsCount].ID = checklists1.ID - r.Checklists[checklistsCount].Name = checklists1.Name - r.Checklists[checklistsCount].Owner = checklists1.Owner - r.Checklists[checklistsCount].UpdatedAt = checklists1.UpdatedAt - } - } - if resp.CompletedChecks != nil { - r.CompletedChecks = types.Int64Value(int64(*resp.CompletedChecks)) - } else { - r.CompletedChecks = types.Int64Null() - } - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.Description = types.StringPointerValue(resp.Description) - r.ExternalResources = []tfTypes.ExternalResourceEntity1{} - if len(r.ExternalResources) > len(resp.ExternalResources) { - r.ExternalResources = r.ExternalResources[:len(resp.ExternalResources)] - } - for externalResourcesCount2, externalResourcesItem2 := range resp.ExternalResources { - var externalResources5 tfTypes.ExternalResourceEntity1 - externalResources5.ConnectionID = types.StringPointerValue(externalResourcesItem2.ConnectionID) - externalResources5.ConnectionName = types.StringPointerValue(externalResourcesItem2.ConnectionName) - externalResources5.ConnectionType = types.StringPointerValue(externalResourcesItem2.ConnectionType) - if externalResourcesItem2.CreatedAt != nil { - externalResources5.CreatedAt = types.StringValue(externalResourcesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.CreatedAt = types.StringNull() - } - externalResources5.Name = types.StringPointerValue(externalResourcesItem2.Name) - externalResources5.RemoteID = types.StringPointerValue(externalResourcesItem2.RemoteID) - externalResources5.RemoteURL = types.StringPointerValue(externalResourcesItem2.RemoteURL) - if externalResourcesItem2.UpdatedAt != nil { - externalResources5.UpdatedAt = types.StringValue(externalResourcesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.UpdatedAt = types.StringNull() - } - if externalResourcesCount2+1 > len(r.ExternalResources) { - r.ExternalResources = append(r.ExternalResources, externalResources5) - } else { - r.ExternalResources[externalResourcesCount2].ConnectionID = externalResources5.ConnectionID - r.ExternalResources[externalResourcesCount2].ConnectionName = externalResources5.ConnectionName - r.ExternalResources[externalResourcesCount2].ConnectionType = externalResources5.ConnectionType - r.ExternalResources[externalResourcesCount2].CreatedAt = externalResources5.CreatedAt - r.ExternalResources[externalResourcesCount2].Name = externalResources5.Name - r.ExternalResources[externalResourcesCount2].RemoteID = externalResources5.RemoteID - r.ExternalResources[externalResourcesCount2].RemoteURL = externalResources5.RemoteURL - r.ExternalResources[externalResourcesCount2].UpdatedAt = externalResources5.UpdatedAt - } - } - r.Functionalities = []tfTypes.Functionalities{} - if len(r.Functionalities) > len(resp.Functionalities) { - r.Functionalities = r.Functionalities[:len(resp.Functionalities)] - } - for functionalitiesCount1, functionalitiesItem1 := range resp.Functionalities { - var functionalities3 tfTypes.Functionalities - functionalities3.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem1.ActiveIncidents { - functionalities3.ActiveIncidents = append(functionalities3.ActiveIncidents, types.StringValue(v)) - } - functionalities3.AlertOnAdd = types.BoolPointerValue(functionalitiesItem1.AlertOnAdd) - functionalities3.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem1.AutoAddRespondingTeam) - if functionalitiesItem1.CreatedAt != nil { - functionalities3.CreatedAt = types.StringValue(functionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.CreatedAt = types.StringNull() - } - functionalities3.Description = types.StringPointerValue(functionalitiesItem1.Description) - functionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount3, externalResourcesItem3 := range functionalitiesItem1.ExternalResources { - var externalResources7 tfTypes.ExternalResourceEntity - externalResources7.ConnectionID = types.StringPointerValue(externalResourcesItem3.ConnectionID) - externalResources7.ConnectionName = types.StringPointerValue(externalResourcesItem3.ConnectionName) - externalResources7.ConnectionType = types.StringPointerValue(externalResourcesItem3.ConnectionType) - if externalResourcesItem3.CreatedAt != nil { - externalResources7.CreatedAt = types.StringValue(externalResourcesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.CreatedAt = types.StringNull() - } - externalResources7.Name = types.StringPointerValue(externalResourcesItem3.Name) - externalResources7.RemoteID = types.StringPointerValue(externalResourcesItem3.RemoteID) - externalResources7.RemoteURL = types.StringPointerValue(externalResourcesItem3.RemoteURL) - if externalResourcesItem3.UpdatedAt != nil { - externalResources7.UpdatedAt = types.StringValue(externalResourcesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.UpdatedAt = types.StringNull() - } - if externalResourcesCount3+1 > len(functionalities3.ExternalResources) { - functionalities3.ExternalResources = append(functionalities3.ExternalResources, externalResources7) - } else { - functionalities3.ExternalResources[externalResourcesCount3].ConnectionID = externalResources7.ConnectionID - functionalities3.ExternalResources[externalResourcesCount3].ConnectionName = externalResources7.ConnectionName - functionalities3.ExternalResources[externalResourcesCount3].ConnectionType = externalResources7.ConnectionType - functionalities3.ExternalResources[externalResourcesCount3].CreatedAt = externalResources7.CreatedAt - functionalities3.ExternalResources[externalResourcesCount3].Name = externalResources7.Name - functionalities3.ExternalResources[externalResourcesCount3].RemoteID = externalResources7.RemoteID - functionalities3.ExternalResources[externalResourcesCount3].RemoteURL = externalResources7.RemoteURL - functionalities3.ExternalResources[externalResourcesCount3].UpdatedAt = externalResources7.UpdatedAt - } - } - functionalities3.ID = types.StringPointerValue(functionalitiesItem1.ID) - if len(functionalitiesItem1.Labels) > 0 { - functionalities3.Labels = make(map[string]types.String) - for key2, value3 := range functionalitiesItem1.Labels { - functionalities3.Labels[key2] = types.StringValue(value3) - } - } - functionalities3.Links = []tfTypes.LinksEntity{} - for linksCount2, linksItem2 := range functionalitiesItem1.Links { - var links5 tfTypes.LinksEntity - links5.HrefURL = types.StringPointerValue(linksItem2.HrefURL) - links5.IconURL = types.StringPointerValue(linksItem2.IconURL) - links5.ID = types.StringPointerValue(linksItem2.ID) - links5.Name = types.StringPointerValue(linksItem2.Name) - if linksCount2+1 > len(functionalities3.Links) { - functionalities3.Links = append(functionalities3.Links, links5) - } else { - functionalities3.Links[linksCount2].HrefURL = links5.HrefURL - functionalities3.Links[linksCount2].IconURL = links5.IconURL - functionalities3.Links[linksCount2].ID = links5.ID - functionalities3.Links[linksCount2].Name = links5.Name - } - } - functionalities3.Name = types.StringPointerValue(functionalitiesItem1.Name) - if functionalitiesItem1.Owner == nil { - functionalities3.Owner = nil - } else { - functionalities3.Owner = &tfTypes.TeamEntity1{} - } - functionalities3.Slug = types.StringPointerValue(functionalitiesItem1.Slug) - if functionalitiesItem1.UpdatedAt != nil { - functionalities3.UpdatedAt = types.StringValue(functionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.UpdatedAt = types.StringNull() - } - if functionalitiesItem1.UpdatedBy == nil { - functionalities3.UpdatedBy = nil - } else { - functionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities3.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Email) - functionalities3.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem1.UpdatedBy.ID) - functionalities3.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Name) - functionalities3.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Source) - } - if functionalitiesCount1+1 > len(r.Functionalities) { - r.Functionalities = append(r.Functionalities, functionalities3) - } else { - r.Functionalities[functionalitiesCount1].ActiveIncidents = functionalities3.ActiveIncidents - r.Functionalities[functionalitiesCount1].AlertOnAdd = functionalities3.AlertOnAdd - r.Functionalities[functionalitiesCount1].AutoAddRespondingTeam = functionalities3.AutoAddRespondingTeam - r.Functionalities[functionalitiesCount1].CreatedAt = functionalities3.CreatedAt - r.Functionalities[functionalitiesCount1].Description = functionalities3.Description - r.Functionalities[functionalitiesCount1].ExternalResources = functionalities3.ExternalResources - r.Functionalities[functionalitiesCount1].ID = functionalities3.ID - r.Functionalities[functionalitiesCount1].Labels = functionalities3.Labels - r.Functionalities[functionalitiesCount1].Links = functionalities3.Links - r.Functionalities[functionalitiesCount1].Name = functionalities3.Name - r.Functionalities[functionalitiesCount1].Owner = functionalities3.Owner - r.Functionalities[functionalitiesCount1].Slug = functionalities3.Slug - r.Functionalities[functionalitiesCount1].UpdatedAt = functionalities3.UpdatedAt - r.Functionalities[functionalitiesCount1].UpdatedBy = functionalities3.UpdatedBy - } - } - r.ID = types.StringPointerValue(resp.ID) - if len(resp.Labels) > 0 { - r.Labels = make(map[string]types.String) - for key3, value4 := range resp.Labels { - r.Labels[key3] = types.StringValue(value4) - } - } - if resp.LastImport == nil { - r.LastImport = nil - } else { - r.LastImport = &tfTypes.ImportsImportableResourceEntity{} - r.LastImport.ImportErrors = []tfTypes.ImportsImportErrorEntity{} - if len(r.LastImport.ImportErrors) > len(resp.LastImport.ImportErrors) { - r.LastImport.ImportErrors = r.LastImport.ImportErrors[:len(resp.LastImport.ImportErrors)] - } - for importErrorsCount, importErrorsItem := range resp.LastImport.ImportErrors { - var importErrors1 tfTypes.ImportsImportErrorEntity - if importErrorsItem.CreatedAt != nil { - importErrors1.CreatedAt = types.StringValue(importErrorsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - importErrors1.CreatedAt = types.StringNull() - } - if importErrorsItem.Data == nil { - importErrors1.Data = nil - } else { - importErrors1.Data = &tfTypes.TeamEntity1{} - } - importErrors1.ID = types.StringPointerValue(importErrorsItem.ID) - importErrors1.Message = types.StringPointerValue(importErrorsItem.Message) - if importErrorsItem.Resource == nil { - importErrors1.Resource = nil - } else { - importErrors1.Resource = &tfTypes.ImportsImportErrorEntityResourceEntity{} - importErrors1.Resource.Name = types.StringPointerValue(importErrorsItem.Resource.Name) - importErrors1.Resource.ResourceID = types.StringPointerValue(importErrorsItem.Resource.ResourceID) - importErrors1.Resource.ResourceType = types.StringPointerValue(importErrorsItem.Resource.ResourceType) - } - if importErrorsCount+1 > len(r.LastImport.ImportErrors) { - r.LastImport.ImportErrors = append(r.LastImport.ImportErrors, importErrors1) - } else { - r.LastImport.ImportErrors[importErrorsCount].CreatedAt = importErrors1.CreatedAt - r.LastImport.ImportErrors[importErrorsCount].Data = importErrors1.Data - r.LastImport.ImportErrors[importErrorsCount].ID = importErrors1.ID - r.LastImport.ImportErrors[importErrorsCount].Message = importErrors1.Message - r.LastImport.ImportErrors[importErrorsCount].Resource = importErrors1.Resource - } - } - if resp.LastImport.ImportedAt != nil { - r.LastImport.ImportedAt = types.StringValue(resp.LastImport.ImportedAt.Format(time.RFC3339Nano)) - } else { - r.LastImport.ImportedAt = types.StringNull() - } - r.LastImport.RemoteID = types.StringPointerValue(resp.LastImport.RemoteID) - if resp.LastImport.State != nil { - r.LastImport.State = types.StringValue(string(*resp.LastImport.State)) - } else { - r.LastImport.State = types.StringNull() - } - } - r.Links = []tfTypes.LinksEntity1{} - if len(r.Links) > len(resp.Links) { - r.Links = r.Links[:len(resp.Links)] - } - for linksCount3, linksItem3 := range resp.Links { - var links7 tfTypes.LinksEntity1 - links7.HrefURL = types.StringPointerValue(linksItem3.HrefURL) - links7.IconURL = types.StringPointerValue(linksItem3.IconURL) - links7.ID = types.StringPointerValue(linksItem3.ID) - links7.Name = types.StringPointerValue(linksItem3.Name) - if linksCount3+1 > len(r.Links) { - r.Links = append(r.Links, links7) - } else { - r.Links[linksCount3].HrefURL = links7.HrefURL - r.Links[linksCount3].IconURL = links7.IconURL - r.Links[linksCount3].ID = links7.ID - r.Links[linksCount3].Name = links7.Name - } - } - r.ManagedBy = types.StringPointerValue(resp.ManagedBy) - if resp.ManagedBySettings == nil { - r.ManagedBySettings = nil - } else { - r.ManagedBySettings = &tfTypes.TeamEntity1{} - } - r.Name = types.StringPointerValue(resp.Name) - if resp.Owner == nil { - r.Owner = nil - } else { - r.Owner = &tfTypes.Owner{} - if resp.Owner.CreatedAt != nil { - r.Owner.CreatedAt = types.StringValue(resp.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.Owner.CreatedAt = types.StringNull() - } - if resp.Owner.CreatedBy == nil { - r.Owner.CreatedBy = nil - } else { - r.Owner.CreatedBy = &tfTypes.AuthorEntity{} - r.Owner.CreatedBy.Email = types.StringPointerValue(resp.Owner.CreatedBy.Email) - r.Owner.CreatedBy.ID = types.StringPointerValue(resp.Owner.CreatedBy.ID) - r.Owner.CreatedBy.Name = types.StringPointerValue(resp.Owner.CreatedBy.Name) - r.Owner.CreatedBy.Source = types.StringPointerValue(resp.Owner.CreatedBy.Source) - } - r.Owner.Description = types.StringPointerValue(resp.Owner.Description) - r.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Owner.Functionalities) > len(resp.Owner.Functionalities) { - r.Owner.Functionalities = r.Owner.Functionalities[:len(resp.Owner.Functionalities)] - } - for functionalitiesCount2, functionalitiesItem2 := range resp.Owner.Functionalities { - var functionalities5 tfTypes.FunctionalityEntity - functionalities5.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem2.ActiveIncidents { - functionalities5.ActiveIncidents = append(functionalities5.ActiveIncidents, types.StringValue(v)) - } - functionalities5.AlertOnAdd = types.BoolPointerValue(functionalitiesItem2.AlertOnAdd) - functionalities5.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem2.AutoAddRespondingTeam) - if functionalitiesItem2.CreatedAt != nil { - functionalities5.CreatedAt = types.StringValue(functionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.CreatedAt = types.StringNull() - } - functionalities5.Description = types.StringPointerValue(functionalitiesItem2.Description) - functionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount4, externalResourcesItem4 := range functionalitiesItem2.ExternalResources { - var externalResources9 tfTypes.ExternalResourceEntity - externalResources9.ConnectionID = types.StringPointerValue(externalResourcesItem4.ConnectionID) - externalResources9.ConnectionName = types.StringPointerValue(externalResourcesItem4.ConnectionName) - externalResources9.ConnectionType = types.StringPointerValue(externalResourcesItem4.ConnectionType) - if externalResourcesItem4.CreatedAt != nil { - externalResources9.CreatedAt = types.StringValue(externalResourcesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.CreatedAt = types.StringNull() - } - externalResources9.Name = types.StringPointerValue(externalResourcesItem4.Name) - externalResources9.RemoteID = types.StringPointerValue(externalResourcesItem4.RemoteID) - externalResources9.RemoteURL = types.StringPointerValue(externalResourcesItem4.RemoteURL) - if externalResourcesItem4.UpdatedAt != nil { - externalResources9.UpdatedAt = types.StringValue(externalResourcesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.UpdatedAt = types.StringNull() - } - if externalResourcesCount4+1 > len(functionalities5.ExternalResources) { - functionalities5.ExternalResources = append(functionalities5.ExternalResources, externalResources9) - } else { - functionalities5.ExternalResources[externalResourcesCount4].ConnectionID = externalResources9.ConnectionID - functionalities5.ExternalResources[externalResourcesCount4].ConnectionName = externalResources9.ConnectionName - functionalities5.ExternalResources[externalResourcesCount4].ConnectionType = externalResources9.ConnectionType - functionalities5.ExternalResources[externalResourcesCount4].CreatedAt = externalResources9.CreatedAt - functionalities5.ExternalResources[externalResourcesCount4].Name = externalResources9.Name - functionalities5.ExternalResources[externalResourcesCount4].RemoteID = externalResources9.RemoteID - functionalities5.ExternalResources[externalResourcesCount4].RemoteURL = externalResources9.RemoteURL - functionalities5.ExternalResources[externalResourcesCount4].UpdatedAt = externalResources9.UpdatedAt - } - } - functionalities5.ID = types.StringPointerValue(functionalitiesItem2.ID) - if len(functionalitiesItem2.Labels) > 0 { - functionalities5.Labels = make(map[string]types.String) - for key4, value5 := range functionalitiesItem2.Labels { - functionalities5.Labels[key4] = types.StringValue(value5) - } - } - functionalities5.Links = []tfTypes.LinksEntity{} - for linksCount4, linksItem4 := range functionalitiesItem2.Links { - var links9 tfTypes.LinksEntity - links9.HrefURL = types.StringPointerValue(linksItem4.HrefURL) - links9.IconURL = types.StringPointerValue(linksItem4.IconURL) - links9.ID = types.StringPointerValue(linksItem4.ID) - links9.Name = types.StringPointerValue(linksItem4.Name) - if linksCount4+1 > len(functionalities5.Links) { - functionalities5.Links = append(functionalities5.Links, links9) - } else { - functionalities5.Links[linksCount4].HrefURL = links9.HrefURL - functionalities5.Links[linksCount4].IconURL = links9.IconURL - functionalities5.Links[linksCount4].ID = links9.ID - functionalities5.Links[linksCount4].Name = links9.Name - } - } - functionalities5.Name = types.StringPointerValue(functionalitiesItem2.Name) - if functionalitiesItem2.Owner == nil { - functionalities5.Owner = nil - } else { - functionalities5.Owner = &tfTypes.TeamEntity1{} - } - functionalities5.Slug = types.StringPointerValue(functionalitiesItem2.Slug) - if functionalitiesItem2.UpdatedAt != nil { - functionalities5.UpdatedAt = types.StringValue(functionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.UpdatedAt = types.StringNull() - } - if functionalitiesItem2.UpdatedBy == nil { - functionalities5.UpdatedBy = nil - } else { - functionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities5.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Email) - functionalities5.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem2.UpdatedBy.ID) - functionalities5.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Name) - functionalities5.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Source) - } - if functionalitiesCount2+1 > len(r.Owner.Functionalities) { - r.Owner.Functionalities = append(r.Owner.Functionalities, functionalities5) - } else { - r.Owner.Functionalities[functionalitiesCount2].ActiveIncidents = functionalities5.ActiveIncidents - r.Owner.Functionalities[functionalitiesCount2].AlertOnAdd = functionalities5.AlertOnAdd - r.Owner.Functionalities[functionalitiesCount2].AutoAddRespondingTeam = functionalities5.AutoAddRespondingTeam - r.Owner.Functionalities[functionalitiesCount2].CreatedAt = functionalities5.CreatedAt - r.Owner.Functionalities[functionalitiesCount2].Description = functionalities5.Description - r.Owner.Functionalities[functionalitiesCount2].ExternalResources = functionalities5.ExternalResources - r.Owner.Functionalities[functionalitiesCount2].ID = functionalities5.ID - r.Owner.Functionalities[functionalitiesCount2].Labels = functionalities5.Labels - r.Owner.Functionalities[functionalitiesCount2].Links = functionalities5.Links - r.Owner.Functionalities[functionalitiesCount2].Name = functionalities5.Name - r.Owner.Functionalities[functionalitiesCount2].Owner = functionalities5.Owner - r.Owner.Functionalities[functionalitiesCount2].Slug = functionalities5.Slug - r.Owner.Functionalities[functionalitiesCount2].UpdatedAt = functionalities5.UpdatedAt - r.Owner.Functionalities[functionalitiesCount2].UpdatedBy = functionalities5.UpdatedBy - } - } - r.Owner.ID = types.StringPointerValue(resp.Owner.ID) - r.Owner.Memberships = []tfTypes.MembershipEntity{} - if len(r.Owner.Memberships) > len(resp.Owner.Memberships) { - r.Owner.Memberships = r.Owner.Memberships[:len(resp.Owner.Memberships)] - } - for membershipsCount1, membershipsItem1 := range resp.Owner.Memberships { - var memberships3 tfTypes.MembershipEntity - if membershipsItem1.DefaultIncidentRole == nil { - memberships3.DefaultIncidentRole = nil - } else { - memberships3.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem1.DefaultIncidentRole.CreatedAt != nil { - memberships3.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Description) - if membershipsItem1.DefaultIncidentRole.DiscardedAt != nil { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.ID) - memberships3.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Name) - memberships3.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Summary) - if membershipsItem1.DefaultIncidentRole.UpdatedAt != nil { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem1.Schedule == nil { - memberships3.Schedule = nil - } else { - memberships3.Schedule = &tfTypes.ScheduleEntity{} - memberships3.Schedule.Discarded = types.BoolPointerValue(membershipsItem1.Schedule.Discarded) - memberships3.Schedule.ID = types.StringPointerValue(membershipsItem1.Schedule.ID) - memberships3.Schedule.Integration = types.StringPointerValue(membershipsItem1.Schedule.Integration) - memberships3.Schedule.Name = types.StringPointerValue(membershipsItem1.Schedule.Name) - } - if membershipsItem1.User == nil { - memberships3.User = nil - } else { - memberships3.User = &tfTypes.UserEntity{} - if membershipsItem1.User.CreatedAt != nil { - memberships3.User.CreatedAt = types.StringValue(membershipsItem1.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.CreatedAt = types.StringNull() - } - memberships3.User.Email = types.StringPointerValue(membershipsItem1.User.Email) - memberships3.User.ID = types.StringPointerValue(membershipsItem1.User.ID) - memberships3.User.Name = types.StringPointerValue(membershipsItem1.User.Name) - memberships3.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem1.User.SignalsEnabledNotificationTypes { - memberships3.User.SignalsEnabledNotificationTypes = append(memberships3.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships3.User.SlackLinked = types.BoolPointerValue(membershipsItem1.User.SlackLinked) - memberships3.User.SlackUserID = types.StringPointerValue(membershipsItem1.User.SlackUserID) - if membershipsItem1.User.UpdatedAt != nil { - memberships3.User.UpdatedAt = types.StringValue(membershipsItem1.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount1+1 > len(r.Owner.Memberships) { - r.Owner.Memberships = append(r.Owner.Memberships, memberships3) - } else { - r.Owner.Memberships[membershipsCount1].DefaultIncidentRole = memberships3.DefaultIncidentRole - r.Owner.Memberships[membershipsCount1].Schedule = memberships3.Schedule - r.Owner.Memberships[membershipsCount1].User = memberships3.User - } - } - if resp.Owner.MsTeamsChannel == nil { - r.Owner.MsTeamsChannel = nil - } else { - r.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelID) - r.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelName) - r.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.Owner.MsTeamsChannel.ChannelURL) - r.Owner.MsTeamsChannel.ID = types.StringPointerValue(resp.Owner.MsTeamsChannel.ID) - r.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.Owner.MsTeamsChannel.MsTeamID) - r.Owner.MsTeamsChannel.Status = types.StringPointerValue(resp.Owner.MsTeamsChannel.Status) - r.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(resp.Owner.MsTeamsChannel.TeamName) - } - r.Owner.Name = types.StringPointerValue(resp.Owner.Name) - r.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.Owner.OwnedFunctionalities) > len(resp.Owner.OwnedFunctionalities) { - r.Owner.OwnedFunctionalities = r.Owner.OwnedFunctionalities[:len(resp.Owner.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount1, ownedFunctionalitiesItem1 := range resp.Owner.OwnedFunctionalities { - var ownedFunctionalities3 tfTypes.FunctionalityEntity - ownedFunctionalities3.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem1.ActiveIncidents { - ownedFunctionalities3.ActiveIncidents = append(ownedFunctionalities3.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities3.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem1.AlertOnAdd) - ownedFunctionalities3.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem1.AutoAddRespondingTeam) - if ownedFunctionalitiesItem1.CreatedAt != nil { - ownedFunctionalities3.CreatedAt = types.StringValue(ownedFunctionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.CreatedAt = types.StringNull() - } - ownedFunctionalities3.Description = types.StringPointerValue(ownedFunctionalitiesItem1.Description) - ownedFunctionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount5, externalResourcesItem5 := range ownedFunctionalitiesItem1.ExternalResources { - var externalResources11 tfTypes.ExternalResourceEntity - externalResources11.ConnectionID = types.StringPointerValue(externalResourcesItem5.ConnectionID) - externalResources11.ConnectionName = types.StringPointerValue(externalResourcesItem5.ConnectionName) - externalResources11.ConnectionType = types.StringPointerValue(externalResourcesItem5.ConnectionType) - if externalResourcesItem5.CreatedAt != nil { - externalResources11.CreatedAt = types.StringValue(externalResourcesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.CreatedAt = types.StringNull() - } - externalResources11.Name = types.StringPointerValue(externalResourcesItem5.Name) - externalResources11.RemoteID = types.StringPointerValue(externalResourcesItem5.RemoteID) - externalResources11.RemoteURL = types.StringPointerValue(externalResourcesItem5.RemoteURL) - if externalResourcesItem5.UpdatedAt != nil { - externalResources11.UpdatedAt = types.StringValue(externalResourcesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.UpdatedAt = types.StringNull() - } - if externalResourcesCount5+1 > len(ownedFunctionalities3.ExternalResources) { - ownedFunctionalities3.ExternalResources = append(ownedFunctionalities3.ExternalResources, externalResources11) - } else { - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionID = externalResources11.ConnectionID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionName = externalResources11.ConnectionName - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionType = externalResources11.ConnectionType - ownedFunctionalities3.ExternalResources[externalResourcesCount5].CreatedAt = externalResources11.CreatedAt - ownedFunctionalities3.ExternalResources[externalResourcesCount5].Name = externalResources11.Name - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteID = externalResources11.RemoteID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteURL = externalResources11.RemoteURL - ownedFunctionalities3.ExternalResources[externalResourcesCount5].UpdatedAt = externalResources11.UpdatedAt - } - } - ownedFunctionalities3.ID = types.StringPointerValue(ownedFunctionalitiesItem1.ID) - if len(ownedFunctionalitiesItem1.Labels) > 0 { - ownedFunctionalities3.Labels = make(map[string]types.String) - for key5, value6 := range ownedFunctionalitiesItem1.Labels { - ownedFunctionalities3.Labels[key5] = types.StringValue(value6) - } - } - ownedFunctionalities3.Links = []tfTypes.LinksEntity{} - for linksCount5, linksItem5 := range ownedFunctionalitiesItem1.Links { - var links11 tfTypes.LinksEntity - links11.HrefURL = types.StringPointerValue(linksItem5.HrefURL) - links11.IconURL = types.StringPointerValue(linksItem5.IconURL) - links11.ID = types.StringPointerValue(linksItem5.ID) - links11.Name = types.StringPointerValue(linksItem5.Name) - if linksCount5+1 > len(ownedFunctionalities3.Links) { - ownedFunctionalities3.Links = append(ownedFunctionalities3.Links, links11) - } else { - ownedFunctionalities3.Links[linksCount5].HrefURL = links11.HrefURL - ownedFunctionalities3.Links[linksCount5].IconURL = links11.IconURL - ownedFunctionalities3.Links[linksCount5].ID = links11.ID - ownedFunctionalities3.Links[linksCount5].Name = links11.Name - } - } - ownedFunctionalities3.Name = types.StringPointerValue(ownedFunctionalitiesItem1.Name) - if ownedFunctionalitiesItem1.Owner == nil { - ownedFunctionalities3.Owner = nil - } else { - ownedFunctionalities3.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities3.Slug = types.StringPointerValue(ownedFunctionalitiesItem1.Slug) - if ownedFunctionalitiesItem1.UpdatedAt != nil { - ownedFunctionalities3.UpdatedAt = types.StringValue(ownedFunctionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem1.UpdatedBy == nil { - ownedFunctionalities3.UpdatedBy = nil - } else { - ownedFunctionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities3.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Email) - ownedFunctionalities3.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.ID) - ownedFunctionalities3.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Name) - ownedFunctionalities3.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Source) - } - if ownedFunctionalitiesCount1+1 > len(r.Owner.OwnedFunctionalities) { - r.Owner.OwnedFunctionalities = append(r.Owner.OwnedFunctionalities, ownedFunctionalities3) - } else { - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ActiveIncidents = ownedFunctionalities3.ActiveIncidents - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AlertOnAdd = ownedFunctionalities3.AlertOnAdd - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AutoAddRespondingTeam = ownedFunctionalities3.AutoAddRespondingTeam - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].CreatedAt = ownedFunctionalities3.CreatedAt - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Description = ownedFunctionalities3.Description - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ExternalResources = ownedFunctionalities3.ExternalResources - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ID = ownedFunctionalities3.ID - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Labels = ownedFunctionalities3.Labels - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Links = ownedFunctionalities3.Links - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Name = ownedFunctionalities3.Name - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Owner = ownedFunctionalities3.Owner - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Slug = ownedFunctionalities3.Slug - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedAt = ownedFunctionalities3.UpdatedAt - r.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedBy = ownedFunctionalities3.UpdatedBy - } - } - r.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.Owner.OwnedRunbooks) > len(resp.Owner.OwnedRunbooks) { - r.Owner.OwnedRunbooks = r.Owner.OwnedRunbooks[:len(resp.Owner.OwnedRunbooks)] - } - for ownedRunbooksCount1, ownedRunbooksItem1 := range resp.Owner.OwnedRunbooks { - var ownedRunbooks3 tfTypes.SlimRunbookEntity - if ownedRunbooksItem1.AttachmentRule == nil { - ownedRunbooks3.AttachmentRule = nil - } else { - ownedRunbooks3.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem1.AttachmentRule.Logic == nil { - ownedRunbooks3.AttachmentRule.Logic = nil - } else { - ownedRunbooks3.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem1.AttachmentRule.UserData == nil { - ownedRunbooks3.AttachmentRule.UserData = nil - } else { - ownedRunbooks3.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks3.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Label) - ownedRunbooks3.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Type) - ownedRunbooks3.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Value) - } - } - ownedRunbooks3.Categories = types.StringPointerValue(ownedRunbooksItem1.Categories) - if ownedRunbooksItem1.CreatedAt != nil { - ownedRunbooks3.CreatedAt = types.StringValue(ownedRunbooksItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.CreatedAt = types.StringNull() - } - ownedRunbooks3.Description = types.StringPointerValue(ownedRunbooksItem1.Description) - ownedRunbooks3.ID = types.StringPointerValue(ownedRunbooksItem1.ID) - ownedRunbooks3.Name = types.StringPointerValue(ownedRunbooksItem1.Name) - if ownedRunbooksItem1.Owner == nil { - ownedRunbooks3.Owner = nil - } else { - ownedRunbooks3.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks3.Summary = types.StringPointerValue(ownedRunbooksItem1.Summary) - ownedRunbooks3.Type = types.StringPointerValue(ownedRunbooksItem1.Type) - if ownedRunbooksItem1.UpdatedAt != nil { - ownedRunbooks3.UpdatedAt = types.StringValue(ownedRunbooksItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount1+1 > len(r.Owner.OwnedRunbooks) { - r.Owner.OwnedRunbooks = append(r.Owner.OwnedRunbooks, ownedRunbooks3) - } else { - r.Owner.OwnedRunbooks[ownedRunbooksCount1].AttachmentRule = ownedRunbooks3.AttachmentRule - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Categories = ownedRunbooks3.Categories - r.Owner.OwnedRunbooks[ownedRunbooksCount1].CreatedAt = ownedRunbooks3.CreatedAt - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Description = ownedRunbooks3.Description - r.Owner.OwnedRunbooks[ownedRunbooksCount1].ID = ownedRunbooks3.ID - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Name = ownedRunbooks3.Name - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Owner = ownedRunbooks3.Owner - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Summary = ownedRunbooks3.Summary - r.Owner.OwnedRunbooks[ownedRunbooksCount1].Type = ownedRunbooks3.Type - r.Owner.OwnedRunbooks[ownedRunbooksCount1].UpdatedAt = ownedRunbooks3.UpdatedAt - } - } - r.Owner.SignalsIcalURL = types.StringPointerValue(resp.Owner.SignalsIcalURL) - if resp.Owner.SlackChannel == nil { - r.Owner.SlackChannel = nil - } else { - r.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.Owner.SlackChannel.ID = types.StringPointerValue(resp.Owner.SlackChannel.ID) - r.Owner.SlackChannel.Name = types.StringPointerValue(resp.Owner.SlackChannel.Name) - r.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(resp.Owner.SlackChannel.SlackChannelID) - } - r.Owner.Slug = types.StringPointerValue(resp.Owner.Slug) - if resp.Owner.UpdatedAt != nil { - r.Owner.UpdatedAt = types.StringValue(resp.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Owner.UpdatedAt = types.StringNull() - } - } - if resp.ServiceChecklistUpdatedAt != nil { - r.ServiceChecklistUpdatedAt = types.StringValue(resp.ServiceChecklistUpdatedAt.Format(time.RFC3339Nano)) - } else { - r.ServiceChecklistUpdatedAt = types.StringNull() - } - if resp.ServiceTier != nil { - r.ServiceTier = types.Int64Value(int64(*resp.ServiceTier)) - } else { - r.ServiceTier = types.Int64Null() - } - r.Slug = types.StringPointerValue(resp.Slug) - r.Teams = []tfTypes.Owner{} - if len(r.Teams) > len(resp.Teams) { - r.Teams = r.Teams[:len(resp.Teams)] - } - for teamsCount, teamsItem := range resp.Teams { - var teams1 tfTypes.Owner - if teamsItem.CreatedAt != nil { - teams1.CreatedAt = types.StringValue(teamsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams1.CreatedAt = types.StringNull() - } - if teamsItem.CreatedBy == nil { - teams1.CreatedBy = nil - } else { - teams1.CreatedBy = &tfTypes.AuthorEntity{} - teams1.CreatedBy.Email = types.StringPointerValue(teamsItem.CreatedBy.Email) - teams1.CreatedBy.ID = types.StringPointerValue(teamsItem.CreatedBy.ID) - teams1.CreatedBy.Name = types.StringPointerValue(teamsItem.CreatedBy.Name) - teams1.CreatedBy.Source = types.StringPointerValue(teamsItem.CreatedBy.Source) - } - teams1.Description = types.StringPointerValue(teamsItem.Description) - teams1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount3, functionalitiesItem3 := range teamsItem.Functionalities { - var functionalities7 tfTypes.FunctionalityEntity - functionalities7.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem3.ActiveIncidents { - functionalities7.ActiveIncidents = append(functionalities7.ActiveIncidents, types.StringValue(v)) - } - functionalities7.AlertOnAdd = types.BoolPointerValue(functionalitiesItem3.AlertOnAdd) - functionalities7.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem3.AutoAddRespondingTeam) - if functionalitiesItem3.CreatedAt != nil { - functionalities7.CreatedAt = types.StringValue(functionalitiesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.CreatedAt = types.StringNull() - } - functionalities7.Description = types.StringPointerValue(functionalitiesItem3.Description) - functionalities7.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount6, externalResourcesItem6 := range functionalitiesItem3.ExternalResources { - var externalResources13 tfTypes.ExternalResourceEntity - externalResources13.ConnectionID = types.StringPointerValue(externalResourcesItem6.ConnectionID) - externalResources13.ConnectionName = types.StringPointerValue(externalResourcesItem6.ConnectionName) - externalResources13.ConnectionType = types.StringPointerValue(externalResourcesItem6.ConnectionType) - if externalResourcesItem6.CreatedAt != nil { - externalResources13.CreatedAt = types.StringValue(externalResourcesItem6.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.CreatedAt = types.StringNull() - } - externalResources13.Name = types.StringPointerValue(externalResourcesItem6.Name) - externalResources13.RemoteID = types.StringPointerValue(externalResourcesItem6.RemoteID) - externalResources13.RemoteURL = types.StringPointerValue(externalResourcesItem6.RemoteURL) - if externalResourcesItem6.UpdatedAt != nil { - externalResources13.UpdatedAt = types.StringValue(externalResourcesItem6.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.UpdatedAt = types.StringNull() - } - if externalResourcesCount6+1 > len(functionalities7.ExternalResources) { - functionalities7.ExternalResources = append(functionalities7.ExternalResources, externalResources13) - } else { - functionalities7.ExternalResources[externalResourcesCount6].ConnectionID = externalResources13.ConnectionID - functionalities7.ExternalResources[externalResourcesCount6].ConnectionName = externalResources13.ConnectionName - functionalities7.ExternalResources[externalResourcesCount6].ConnectionType = externalResources13.ConnectionType - functionalities7.ExternalResources[externalResourcesCount6].CreatedAt = externalResources13.CreatedAt - functionalities7.ExternalResources[externalResourcesCount6].Name = externalResources13.Name - functionalities7.ExternalResources[externalResourcesCount6].RemoteID = externalResources13.RemoteID - functionalities7.ExternalResources[externalResourcesCount6].RemoteURL = externalResources13.RemoteURL - functionalities7.ExternalResources[externalResourcesCount6].UpdatedAt = externalResources13.UpdatedAt - } - } - functionalities7.ID = types.StringPointerValue(functionalitiesItem3.ID) - if len(functionalitiesItem3.Labels) > 0 { - functionalities7.Labels = make(map[string]types.String) - for key6, value8 := range functionalitiesItem3.Labels { - functionalities7.Labels[key6] = types.StringValue(value8) - } - } - functionalities7.Links = []tfTypes.LinksEntity{} - for linksCount6, linksItem6 := range functionalitiesItem3.Links { - var links13 tfTypes.LinksEntity - links13.HrefURL = types.StringPointerValue(linksItem6.HrefURL) - links13.IconURL = types.StringPointerValue(linksItem6.IconURL) - links13.ID = types.StringPointerValue(linksItem6.ID) - links13.Name = types.StringPointerValue(linksItem6.Name) - if linksCount6+1 > len(functionalities7.Links) { - functionalities7.Links = append(functionalities7.Links, links13) - } else { - functionalities7.Links[linksCount6].HrefURL = links13.HrefURL - functionalities7.Links[linksCount6].IconURL = links13.IconURL - functionalities7.Links[linksCount6].ID = links13.ID - functionalities7.Links[linksCount6].Name = links13.Name - } - } - functionalities7.Name = types.StringPointerValue(functionalitiesItem3.Name) - if functionalitiesItem3.Owner == nil { - functionalities7.Owner = nil - } else { - functionalities7.Owner = &tfTypes.TeamEntity1{} - } - functionalities7.Slug = types.StringPointerValue(functionalitiesItem3.Slug) - if functionalitiesItem3.UpdatedAt != nil { - functionalities7.UpdatedAt = types.StringValue(functionalitiesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.UpdatedAt = types.StringNull() - } - if functionalitiesItem3.UpdatedBy == nil { - functionalities7.UpdatedBy = nil - } else { - functionalities7.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities7.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Email) - functionalities7.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem3.UpdatedBy.ID) - functionalities7.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Name) - functionalities7.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Source) - } - if functionalitiesCount3+1 > len(teams1.Functionalities) { - teams1.Functionalities = append(teams1.Functionalities, functionalities7) - } else { - teams1.Functionalities[functionalitiesCount3].ActiveIncidents = functionalities7.ActiveIncidents - teams1.Functionalities[functionalitiesCount3].AlertOnAdd = functionalities7.AlertOnAdd - teams1.Functionalities[functionalitiesCount3].AutoAddRespondingTeam = functionalities7.AutoAddRespondingTeam - teams1.Functionalities[functionalitiesCount3].CreatedAt = functionalities7.CreatedAt - teams1.Functionalities[functionalitiesCount3].Description = functionalities7.Description - teams1.Functionalities[functionalitiesCount3].ExternalResources = functionalities7.ExternalResources - teams1.Functionalities[functionalitiesCount3].ID = functionalities7.ID - teams1.Functionalities[functionalitiesCount3].Labels = functionalities7.Labels - teams1.Functionalities[functionalitiesCount3].Links = functionalities7.Links - teams1.Functionalities[functionalitiesCount3].Name = functionalities7.Name - teams1.Functionalities[functionalitiesCount3].Owner = functionalities7.Owner - teams1.Functionalities[functionalitiesCount3].Slug = functionalities7.Slug - teams1.Functionalities[functionalitiesCount3].UpdatedAt = functionalities7.UpdatedAt - teams1.Functionalities[functionalitiesCount3].UpdatedBy = functionalities7.UpdatedBy - } - } - teams1.ID = types.StringPointerValue(teamsItem.ID) - teams1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount2, membershipsItem2 := range teamsItem.Memberships { - var memberships5 tfTypes.MembershipEntity - if membershipsItem2.DefaultIncidentRole == nil { - memberships5.DefaultIncidentRole = nil - } else { - memberships5.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem2.DefaultIncidentRole.CreatedAt != nil { - memberships5.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Description) - if membershipsItem2.DefaultIncidentRole.DiscardedAt != nil { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.ID) - memberships5.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Name) - memberships5.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Summary) - if membershipsItem2.DefaultIncidentRole.UpdatedAt != nil { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem2.Schedule == nil { - memberships5.Schedule = nil - } else { - memberships5.Schedule = &tfTypes.ScheduleEntity{} - memberships5.Schedule.Discarded = types.BoolPointerValue(membershipsItem2.Schedule.Discarded) - memberships5.Schedule.ID = types.StringPointerValue(membershipsItem2.Schedule.ID) - memberships5.Schedule.Integration = types.StringPointerValue(membershipsItem2.Schedule.Integration) - memberships5.Schedule.Name = types.StringPointerValue(membershipsItem2.Schedule.Name) - } - if membershipsItem2.User == nil { - memberships5.User = nil - } else { - memberships5.User = &tfTypes.UserEntity{} - if membershipsItem2.User.CreatedAt != nil { - memberships5.User.CreatedAt = types.StringValue(membershipsItem2.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.CreatedAt = types.StringNull() - } - memberships5.User.Email = types.StringPointerValue(membershipsItem2.User.Email) - memberships5.User.ID = types.StringPointerValue(membershipsItem2.User.ID) - memberships5.User.Name = types.StringPointerValue(membershipsItem2.User.Name) - memberships5.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem2.User.SignalsEnabledNotificationTypes { - memberships5.User.SignalsEnabledNotificationTypes = append(memberships5.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships5.User.SlackLinked = types.BoolPointerValue(membershipsItem2.User.SlackLinked) - memberships5.User.SlackUserID = types.StringPointerValue(membershipsItem2.User.SlackUserID) - if membershipsItem2.User.UpdatedAt != nil { - memberships5.User.UpdatedAt = types.StringValue(membershipsItem2.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount2+1 > len(teams1.Memberships) { - teams1.Memberships = append(teams1.Memberships, memberships5) - } else { - teams1.Memberships[membershipsCount2].DefaultIncidentRole = memberships5.DefaultIncidentRole - teams1.Memberships[membershipsCount2].Schedule = memberships5.Schedule - teams1.Memberships[membershipsCount2].User = memberships5.User - } - } - if teamsItem.MsTeamsChannel == nil { - teams1.MsTeamsChannel = nil - } else { - teams1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams1.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelID) - teams1.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelName) - teams1.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelURL) - teams1.MsTeamsChannel.ID = types.StringPointerValue(teamsItem.MsTeamsChannel.ID) - teams1.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem.MsTeamsChannel.MsTeamID) - teams1.MsTeamsChannel.Status = types.StringPointerValue(teamsItem.MsTeamsChannel.Status) - teams1.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem.MsTeamsChannel.TeamName) - } - teams1.Name = types.StringPointerValue(teamsItem.Name) - teams1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount2, ownedFunctionalitiesItem2 := range teamsItem.OwnedFunctionalities { - var ownedFunctionalities5 tfTypes.FunctionalityEntity - ownedFunctionalities5.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem2.ActiveIncidents { - ownedFunctionalities5.ActiveIncidents = append(ownedFunctionalities5.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities5.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem2.AlertOnAdd) - ownedFunctionalities5.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem2.AutoAddRespondingTeam) - if ownedFunctionalitiesItem2.CreatedAt != nil { - ownedFunctionalities5.CreatedAt = types.StringValue(ownedFunctionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.CreatedAt = types.StringNull() - } - ownedFunctionalities5.Description = types.StringPointerValue(ownedFunctionalitiesItem2.Description) - ownedFunctionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount7, externalResourcesItem7 := range ownedFunctionalitiesItem2.ExternalResources { - var externalResources15 tfTypes.ExternalResourceEntity - externalResources15.ConnectionID = types.StringPointerValue(externalResourcesItem7.ConnectionID) - externalResources15.ConnectionName = types.StringPointerValue(externalResourcesItem7.ConnectionName) - externalResources15.ConnectionType = types.StringPointerValue(externalResourcesItem7.ConnectionType) - if externalResourcesItem7.CreatedAt != nil { - externalResources15.CreatedAt = types.StringValue(externalResourcesItem7.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.CreatedAt = types.StringNull() - } - externalResources15.Name = types.StringPointerValue(externalResourcesItem7.Name) - externalResources15.RemoteID = types.StringPointerValue(externalResourcesItem7.RemoteID) - externalResources15.RemoteURL = types.StringPointerValue(externalResourcesItem7.RemoteURL) - if externalResourcesItem7.UpdatedAt != nil { - externalResources15.UpdatedAt = types.StringValue(externalResourcesItem7.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.UpdatedAt = types.StringNull() - } - if externalResourcesCount7+1 > len(ownedFunctionalities5.ExternalResources) { - ownedFunctionalities5.ExternalResources = append(ownedFunctionalities5.ExternalResources, externalResources15) - } else { - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionID = externalResources15.ConnectionID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionName = externalResources15.ConnectionName - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionType = externalResources15.ConnectionType - ownedFunctionalities5.ExternalResources[externalResourcesCount7].CreatedAt = externalResources15.CreatedAt - ownedFunctionalities5.ExternalResources[externalResourcesCount7].Name = externalResources15.Name - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteID = externalResources15.RemoteID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteURL = externalResources15.RemoteURL - ownedFunctionalities5.ExternalResources[externalResourcesCount7].UpdatedAt = externalResources15.UpdatedAt - } - } - ownedFunctionalities5.ID = types.StringPointerValue(ownedFunctionalitiesItem2.ID) - if len(ownedFunctionalitiesItem2.Labels) > 0 { - ownedFunctionalities5.Labels = make(map[string]types.String) - for key7, value9 := range ownedFunctionalitiesItem2.Labels { - ownedFunctionalities5.Labels[key7] = types.StringValue(value9) - } - } - ownedFunctionalities5.Links = []tfTypes.LinksEntity{} - for linksCount7, linksItem7 := range ownedFunctionalitiesItem2.Links { - var links15 tfTypes.LinksEntity - links15.HrefURL = types.StringPointerValue(linksItem7.HrefURL) - links15.IconURL = types.StringPointerValue(linksItem7.IconURL) - links15.ID = types.StringPointerValue(linksItem7.ID) - links15.Name = types.StringPointerValue(linksItem7.Name) - if linksCount7+1 > len(ownedFunctionalities5.Links) { - ownedFunctionalities5.Links = append(ownedFunctionalities5.Links, links15) - } else { - ownedFunctionalities5.Links[linksCount7].HrefURL = links15.HrefURL - ownedFunctionalities5.Links[linksCount7].IconURL = links15.IconURL - ownedFunctionalities5.Links[linksCount7].ID = links15.ID - ownedFunctionalities5.Links[linksCount7].Name = links15.Name - } - } - ownedFunctionalities5.Name = types.StringPointerValue(ownedFunctionalitiesItem2.Name) - if ownedFunctionalitiesItem2.Owner == nil { - ownedFunctionalities5.Owner = nil - } else { - ownedFunctionalities5.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities5.Slug = types.StringPointerValue(ownedFunctionalitiesItem2.Slug) - if ownedFunctionalitiesItem2.UpdatedAt != nil { - ownedFunctionalities5.UpdatedAt = types.StringValue(ownedFunctionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem2.UpdatedBy == nil { - ownedFunctionalities5.UpdatedBy = nil - } else { - ownedFunctionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities5.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Email) - ownedFunctionalities5.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.ID) - ownedFunctionalities5.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Name) - ownedFunctionalities5.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Source) - } - if ownedFunctionalitiesCount2+1 > len(teams1.OwnedFunctionalities) { - teams1.OwnedFunctionalities = append(teams1.OwnedFunctionalities, ownedFunctionalities5) - } else { - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ActiveIncidents = ownedFunctionalities5.ActiveIncidents - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AlertOnAdd = ownedFunctionalities5.AlertOnAdd - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AutoAddRespondingTeam = ownedFunctionalities5.AutoAddRespondingTeam - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].CreatedAt = ownedFunctionalities5.CreatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Description = ownedFunctionalities5.Description - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ExternalResources = ownedFunctionalities5.ExternalResources - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ID = ownedFunctionalities5.ID - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Labels = ownedFunctionalities5.Labels - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Links = ownedFunctionalities5.Links - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Name = ownedFunctionalities5.Name - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Owner = ownedFunctionalities5.Owner - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Slug = ownedFunctionalities5.Slug - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedAt = ownedFunctionalities5.UpdatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedBy = ownedFunctionalities5.UpdatedBy - } - } - teams1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount2, ownedRunbooksItem2 := range teamsItem.OwnedRunbooks { - var ownedRunbooks5 tfTypes.SlimRunbookEntity - if ownedRunbooksItem2.AttachmentRule == nil { - ownedRunbooks5.AttachmentRule = nil - } else { - ownedRunbooks5.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem2.AttachmentRule.Logic == nil { - ownedRunbooks5.AttachmentRule.Logic = nil - } else { - ownedRunbooks5.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem2.AttachmentRule.UserData == nil { - ownedRunbooks5.AttachmentRule.UserData = nil - } else { - ownedRunbooks5.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks5.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Label) - ownedRunbooks5.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Type) - ownedRunbooks5.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Value) - } - } - ownedRunbooks5.Categories = types.StringPointerValue(ownedRunbooksItem2.Categories) - if ownedRunbooksItem2.CreatedAt != nil { - ownedRunbooks5.CreatedAt = types.StringValue(ownedRunbooksItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.CreatedAt = types.StringNull() - } - ownedRunbooks5.Description = types.StringPointerValue(ownedRunbooksItem2.Description) - ownedRunbooks5.ID = types.StringPointerValue(ownedRunbooksItem2.ID) - ownedRunbooks5.Name = types.StringPointerValue(ownedRunbooksItem2.Name) - if ownedRunbooksItem2.Owner == nil { - ownedRunbooks5.Owner = nil - } else { - ownedRunbooks5.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks5.Summary = types.StringPointerValue(ownedRunbooksItem2.Summary) - ownedRunbooks5.Type = types.StringPointerValue(ownedRunbooksItem2.Type) - if ownedRunbooksItem2.UpdatedAt != nil { - ownedRunbooks5.UpdatedAt = types.StringValue(ownedRunbooksItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount2+1 > len(teams1.OwnedRunbooks) { - teams1.OwnedRunbooks = append(teams1.OwnedRunbooks, ownedRunbooks5) - } else { - teams1.OwnedRunbooks[ownedRunbooksCount2].AttachmentRule = ownedRunbooks5.AttachmentRule - teams1.OwnedRunbooks[ownedRunbooksCount2].Categories = ownedRunbooks5.Categories - teams1.OwnedRunbooks[ownedRunbooksCount2].CreatedAt = ownedRunbooks5.CreatedAt - teams1.OwnedRunbooks[ownedRunbooksCount2].Description = ownedRunbooks5.Description - teams1.OwnedRunbooks[ownedRunbooksCount2].ID = ownedRunbooks5.ID - teams1.OwnedRunbooks[ownedRunbooksCount2].Name = ownedRunbooks5.Name - teams1.OwnedRunbooks[ownedRunbooksCount2].Owner = ownedRunbooks5.Owner - teams1.OwnedRunbooks[ownedRunbooksCount2].Summary = ownedRunbooks5.Summary - teams1.OwnedRunbooks[ownedRunbooksCount2].Type = ownedRunbooks5.Type - teams1.OwnedRunbooks[ownedRunbooksCount2].UpdatedAt = ownedRunbooks5.UpdatedAt - } - } - teams1.SignalsIcalURL = types.StringPointerValue(teamsItem.SignalsIcalURL) - if teamsItem.SlackChannel == nil { - teams1.SlackChannel = nil - } else { - teams1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams1.SlackChannel.ID = types.StringPointerValue(teamsItem.SlackChannel.ID) - teams1.SlackChannel.Name = types.StringPointerValue(teamsItem.SlackChannel.Name) - teams1.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem.SlackChannel.SlackChannelID) - } - teams1.Slug = types.StringPointerValue(teamsItem.Slug) - if teamsItem.UpdatedAt != nil { - teams1.UpdatedAt = types.StringValue(teamsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams1.UpdatedAt = types.StringNull() - } - if teamsCount+1 > len(r.Teams) { - r.Teams = append(r.Teams, teams1) - } else { - r.Teams[teamsCount].CreatedAt = teams1.CreatedAt - r.Teams[teamsCount].CreatedBy = teams1.CreatedBy - r.Teams[teamsCount].Description = teams1.Description - r.Teams[teamsCount].Functionalities = teams1.Functionalities - r.Teams[teamsCount].ID = teams1.ID - r.Teams[teamsCount].Memberships = teams1.Memberships - r.Teams[teamsCount].MsTeamsChannel = teams1.MsTeamsChannel - r.Teams[teamsCount].Name = teams1.Name - r.Teams[teamsCount].OwnedFunctionalities = teams1.OwnedFunctionalities - r.Teams[teamsCount].OwnedRunbooks = teams1.OwnedRunbooks - r.Teams[teamsCount].SignalsIcalURL = teams1.SignalsIcalURL - r.Teams[teamsCount].SlackChannel = teams1.SlackChannel - r.Teams[teamsCount].Slug = teams1.Slug - r.Teams[teamsCount].UpdatedAt = teams1.UpdatedAt - } - } - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - if resp.UpdatedBy == nil { - r.UpdatedBy = nil - } else { - r.UpdatedBy = &tfTypes.AuthorEntity{} - r.UpdatedBy.Email = types.StringPointerValue(resp.UpdatedBy.Email) - r.UpdatedBy.ID = types.StringPointerValue(resp.UpdatedBy.ID) - r.UpdatedBy.Name = types.StringPointerValue(resp.UpdatedBy.Name) - r.UpdatedBy.Source = types.StringPointerValue(resp.UpdatedBy.Source) - } - } -} - -func (r *ServiceResourceModel) ToSharedPatchV1ServicesServiceID() *shared.PatchV1ServicesServiceID { - alertOnAdd := new(bool) - if !r.AlertOnAdd.IsUnknown() && !r.AlertOnAdd.IsNull() { - *alertOnAdd = r.AlertOnAdd.ValueBool() - } else { - alertOnAdd = nil - } - autoAddRespondingTeam := new(bool) - if !r.AutoAddRespondingTeam.IsUnknown() && !r.AutoAddRespondingTeam.IsNull() { - *autoAddRespondingTeam = r.AutoAddRespondingTeam.ValueBool() - } else { - autoAddRespondingTeam = nil - } - var checklists []shared.Checklists = []shared.Checklists{} - for _, checklistsItem := range r.Checklists { - var id string - id = checklistsItem.ID.ValueString() - - // Service#update.checklists.removeService#update.checklists.remove impedance mismatch: boolean != stringtrace=["Service#create.resp.checklists.[].created_at"] - var remove *bool - checklists = append(checklists, shared.Checklists{ - ID: id, - Remove: remove, - }) - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - var externalResources []shared.PatchV1ServicesServiceIDExternalResources = []shared.PatchV1ServicesServiceIDExternalResources{} - for _, externalResourcesItem := range r.ExternalResources { - var remoteID string - remoteID = externalResourcesItem.RemoteID.ValueString() - - connectionType := new(string) - if !externalResourcesItem.ConnectionType.IsUnknown() && !externalResourcesItem.ConnectionType.IsNull() { - *connectionType = externalResourcesItem.ConnectionType.ValueString() - } else { - connectionType = nil - } - // Service#update.external_resources.removeService#update.external_resources.remove impedance mismatch: boolean != stringtrace=["Service#create.req.external_resources.[].connection_type"] - var remove1 *bool - externalResources = append(externalResources, shared.PatchV1ServicesServiceIDExternalResources{ - RemoteID: remoteID, - ConnectionType: connectionType, - Remove: remove1, - }) - } - var functionalities []shared.PatchV1ServicesServiceIDFunctionalities = []shared.PatchV1ServicesServiceIDFunctionalities{} - for _, functionalitiesItem := range r.Functionalities { - id1 := new(string) - if !functionalitiesItem.ID.IsUnknown() && !functionalitiesItem.ID.IsNull() { - *id1 = functionalitiesItem.ID.ValueString() - } else { - id1 = nil - } - remove2 := new(bool) - if !functionalitiesItem.AlertOnAdd.IsUnknown() && !functionalitiesItem.AlertOnAdd.IsNull() { - *remove2 = functionalitiesItem.AlertOnAdd.ValueBool() - } else { - remove2 = nil - } - summary := new(string) - if !functionalitiesItem.Summary.IsUnknown() && !functionalitiesItem.Summary.IsNull() { - *summary = functionalitiesItem.Summary.ValueString() - } else { - summary = nil - } - functionalities = append(functionalities, shared.PatchV1ServicesServiceIDFunctionalities{ - ID: id1, - Remove: remove2, - Summary: summary, - }) - } - labels := make(map[string]string) - for labelsKey, labelsValue := range r.Labels { - var labelsInst string - labelsInst = labelsValue.ValueString() - - labels[labelsKey] = labelsInst - } - var links []shared.PatchV1ServicesServiceIDLinks = []shared.PatchV1ServicesServiceIDLinks{} - for _, linksItem := range r.Links { - var hrefURL string - hrefURL = linksItem.HrefURL.ValueString() - - var name string - name = linksItem.Name.ValueString() - - iconURL := new(string) - if !linksItem.IconURL.IsUnknown() && !linksItem.IconURL.IsNull() { - *iconURL = linksItem.IconURL.ValueString() - } else { - iconURL = nil - } - // Service#update.links.removeService#update.links.remove impedance mismatch: boolean != stringtrace=["Service#create.req.links.[].name"] - var remove3 *bool - id2 := new(string) - if !linksItem.ID.IsUnknown() && !linksItem.ID.IsNull() { - *id2 = linksItem.ID.ValueString() - } else { - id2 = nil - } - links = append(links, shared.PatchV1ServicesServiceIDLinks{ - HrefURL: hrefURL, - Name: name, - IconURL: iconURL, - Remove: remove3, - ID: id2, - }) - } - name1 := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name1 = r.Name.ValueString() - } else { - name1 = nil - } - var owner *shared.PatchV1ServicesServiceIDOwner - if r.Owner != nil { - var id3 string - id3 = r.Owner.ID.ValueString() - - owner = &shared.PatchV1ServicesServiceIDOwner{ - ID: id3, - } - } - serviceTier := new(shared.PatchV1ServicesServiceIDServiceTier) - if !r.ServiceTier.IsUnknown() && !r.ServiceTier.IsNull() { - *serviceTier = shared.PatchV1ServicesServiceIDServiceTier(r.ServiceTier.ValueInt64()) - } else { - serviceTier = nil - } - var teams []shared.PatchV1ServicesServiceIDTeams = []shared.PatchV1ServicesServiceIDTeams{} - for _, teamsItem := range r.Teams { - var id4 string - id4 = teamsItem.ID.ValueString() - - // Service#update.teams.removeService#update.teams.remove impedance mismatch: boolean != classtrace=["Service#create.resp.teams.[].created_by"] - var remove4 *bool - teams = append(teams, shared.PatchV1ServicesServiceIDTeams{ - ID: id4, - Remove: remove4, - }) - } - out := shared.PatchV1ServicesServiceID{ - AlertOnAdd: alertOnAdd, - AutoAddRespondingTeam: autoAddRespondingTeam, - Checklists: checklists, - Description: description, - ExternalResources: externalResources, - Functionalities: functionalities, - Labels: labels, - Links: links, - Name: name1, - Owner: owner, - ServiceTier: serviceTier, - Teams: teams, - } - return &out -} diff --git a/internal/provider/servicedependency_data_source.go b/internal/provider/servicedependency_data_source.go deleted file mode 100644 index a55ea7f..0000000 --- a/internal/provider/servicedependency_data_source.go +++ /dev/null @@ -1,3525 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &ServiceDependencyDataSource{} -var _ datasource.DataSourceWithConfigure = &ServiceDependencyDataSource{} - -func NewServiceDependencyDataSource() datasource.DataSource { - return &ServiceDependencyDataSource{} -} - -// ServiceDependencyDataSource is the data source implementation. -type ServiceDependencyDataSource struct { - client *sdk.Firehydrant -} - -// ServiceDependencyDataSourceModel describes the data model. -type ServiceDependencyDataSourceModel struct { - ConnectedService *tfTypes.ServiceEntity `tfsdk:"connected_service"` - CreatedAt types.String `tfsdk:"created_at"` - ID types.String `tfsdk:"id"` - Notes types.String `tfsdk:"notes"` - Service *tfTypes.ServiceEntity `tfsdk:"service"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *ServiceDependencyDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_service_dependency" -} - -// Schema defines the schema for the data source. -func (r *ServiceDependencyDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "ServiceDependency DataSource", - - Attributes: map[string]schema.Attribute{ - "connected_service": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "allowed_params": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "checklists": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of checklists associated with a service`, - }, - "completed_checks": schema.Int64Attribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - Description: `List of functionalities attached to the service`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "last_import": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "import_errors": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "data": schema.SingleNestedAttribute{ - Computed: true, - Description: `Additional error data`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "resource": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Computed: true, - }, - "resource_id": schema.StringAttribute{ - Computed: true, - }, - "resource_type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "imported_at": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this service.`, - }, - "managed_by": schema.StringAttribute{ - Computed: true, - Description: `If set, this field indicates that the service is managed by an integration and thus cannot be set manually`, - }, - "managed_by_settings": schema.SingleNestedAttribute{ - Computed: true, - Description: `Indicates the settings of the catalog that manages this service`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "service_checklist_updated_at": schema.StringAttribute{ - Computed: true, - }, - "service_tier": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of teams attached to the service`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - Description: `ServiceEntity model`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "notes": schema.StringAttribute{ - Computed: true, - }, - "service": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "allowed_params": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "checklists": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of checklists associated with a service`, - }, - "completed_checks": schema.Int64Attribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - Description: `List of functionalities attached to the service`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "last_import": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "import_errors": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "data": schema.SingleNestedAttribute{ - Computed: true, - Description: `Additional error data`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "resource": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Computed: true, - }, - "resource_id": schema.StringAttribute{ - Computed: true, - }, - "resource_type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "imported_at": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this service.`, - }, - "managed_by": schema.StringAttribute{ - Computed: true, - Description: `If set, this field indicates that the service is managed by an integration and thus cannot be set manually`, - }, - "managed_by_settings": schema.SingleNestedAttribute{ - Computed: true, - Description: `Indicates the settings of the catalog that manages this service`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "service_checklist_updated_at": schema.StringAttribute{ - Computed: true, - }, - "service_tier": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of teams attached to the service`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - Description: `ServiceEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *ServiceDependencyDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *ServiceDependencyDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *ServiceDependencyDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var serviceDependencyID string - serviceDependencyID = data.ID.ValueString() - - request := operations.GetV1ServiceDependenciesServiceDependencyIDRequest{ - ServiceDependencyID: serviceDependencyID, - } - res, err := r.client.ServiceDependencies.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceDependencyEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceDependencyEntity(res.ServiceDependencyEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/servicedependency_data_source_sdk.go b/internal/provider/servicedependency_data_source_sdk.go deleted file mode 100644 index 5ed3921..0000000 --- a/internal/provider/servicedependency_data_source_sdk.go +++ /dev/null @@ -1,3109 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *ServiceDependencyDataSourceModel) RefreshFromSharedServiceDependencyEntity(resp *shared.ServiceDependencyEntity) { - if resp != nil { - if resp.ConnectedService == nil { - r.ConnectedService = nil - } else { - r.ConnectedService = &tfTypes.ServiceEntity{} - r.ConnectedService.ActiveIncidents = []types.String{} - for _, v := range resp.ConnectedService.ActiveIncidents { - r.ConnectedService.ActiveIncidents = append(r.ConnectedService.ActiveIncidents, types.StringValue(v)) - } - r.ConnectedService.AlertOnAdd = types.BoolPointerValue(resp.ConnectedService.AlertOnAdd) - r.ConnectedService.AllowedParams = []types.String{} - for _, v := range resp.ConnectedService.AllowedParams { - r.ConnectedService.AllowedParams = append(r.ConnectedService.AllowedParams, types.StringValue(v)) - } - r.ConnectedService.AutoAddRespondingTeam = types.BoolPointerValue(resp.ConnectedService.AutoAddRespondingTeam) - r.ConnectedService.Checklists = []tfTypes.Checklists{} - if len(r.ConnectedService.Checklists) > len(resp.ConnectedService.Checklists) { - r.ConnectedService.Checklists = r.ConnectedService.Checklists[:len(resp.ConnectedService.Checklists)] - } - for checklistsCount, checklistsItem := range resp.ConnectedService.Checklists { - var checklists1 tfTypes.Checklists - checklists1.Checks = []tfTypes.ChecklistCheckEntity{} - for checksCount, checksItem := range checklistsItem.Checks { - var checks1 tfTypes.ChecklistCheckEntity - checks1.Description = types.StringPointerValue(checksItem.Description) - checks1.ID = types.StringPointerValue(checksItem.ID) - checks1.Name = types.StringPointerValue(checksItem.Name) - checks1.Status = types.BoolPointerValue(checksItem.Status) - if checksCount+1 > len(checklists1.Checks) { - checklists1.Checks = append(checklists1.Checks, checks1) - } else { - checklists1.Checks[checksCount].Description = checks1.Description - checklists1.Checks[checksCount].ID = checks1.ID - checklists1.Checks[checksCount].Name = checks1.Name - checklists1.Checks[checksCount].Status = checks1.Status - } - } - checklists1.CreatedAt = types.StringPointerValue(checklistsItem.CreatedAt) - checklists1.Description = types.StringPointerValue(checklistsItem.Description) - checklists1.ID = types.StringPointerValue(checklistsItem.ID) - checklists1.Name = types.StringPointerValue(checklistsItem.Name) - if checklistsItem.Owner == nil { - checklists1.Owner = nil - } else { - checklists1.Owner = &tfTypes.TeamEntity{} - if checklistsItem.Owner.CreatedAt != nil { - checklists1.Owner.CreatedAt = types.StringValue(checklistsItem.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.CreatedAt = types.StringNull() - } - if checklistsItem.Owner.CreatedBy == nil { - checklists1.Owner.CreatedBy = nil - } else { - checklists1.Owner.CreatedBy = &tfTypes.AuthorEntity{} - checklists1.Owner.CreatedBy.Email = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Email) - checklists1.Owner.CreatedBy.ID = types.StringPointerValue(checklistsItem.Owner.CreatedBy.ID) - checklists1.Owner.CreatedBy.Name = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Name) - checklists1.Owner.CreatedBy.Source = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Source) - } - checklists1.Owner.Description = types.StringPointerValue(checklistsItem.Owner.Description) - checklists1.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount, functionalitiesItem := range checklistsItem.Owner.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(checklists1.Owner.Functionalities) { - checklists1.Owner.Functionalities = append(checklists1.Owner.Functionalities, functionalities1) - } else { - checklists1.Owner.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - checklists1.Owner.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - checklists1.Owner.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - checklists1.Owner.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - checklists1.Owner.Functionalities[functionalitiesCount].Description = functionalities1.Description - checklists1.Owner.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - checklists1.Owner.Functionalities[functionalitiesCount].ID = functionalities1.ID - checklists1.Owner.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - checklists1.Owner.Functionalities[functionalitiesCount].Links = functionalities1.Links - checklists1.Owner.Functionalities[functionalitiesCount].Name = functionalities1.Name - checklists1.Owner.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - checklists1.Owner.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - checklists1.Owner.ID = types.StringPointerValue(checklistsItem.Owner.ID) - checklists1.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range checklistsItem.Owner.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(checklists1.Owner.Memberships) { - checklists1.Owner.Memberships = append(checklists1.Owner.Memberships, memberships1) - } else { - checklists1.Owner.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - checklists1.Owner.Memberships[membershipsCount].Schedule = memberships1.Schedule - checklists1.Owner.Memberships[membershipsCount].User = memberships1.User - } - } - if checklistsItem.Owner.MsTeamsChannel == nil { - checklists1.Owner.MsTeamsChannel = nil - } else { - checklists1.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - checklists1.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelID) - checklists1.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelName) - checklists1.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelURL) - checklists1.Owner.MsTeamsChannel.ID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ID) - checklists1.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.MsTeamID) - checklists1.Owner.MsTeamsChannel.Status = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.Status) - checklists1.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.TeamName) - } - checklists1.Owner.Name = types.StringPointerValue(checklistsItem.Owner.Name) - checklists1.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range checklistsItem.Owner.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(checklists1.Owner.OwnedFunctionalities) { - checklists1.Owner.OwnedFunctionalities = append(checklists1.Owner.OwnedFunctionalities, ownedFunctionalities1) - } else { - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - checklists1.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range checklistsItem.Owner.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(checklists1.Owner.OwnedRunbooks) { - checklists1.Owner.OwnedRunbooks = append(checklists1.Owner.OwnedRunbooks, ownedRunbooks1) - } else { - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - checklists1.Owner.SignalsIcalURL = types.StringPointerValue(checklistsItem.Owner.SignalsIcalURL) - if checklistsItem.Owner.SlackChannel == nil { - checklists1.Owner.SlackChannel = nil - } else { - checklists1.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - checklists1.Owner.SlackChannel.ID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.ID) - checklists1.Owner.SlackChannel.Name = types.StringPointerValue(checklistsItem.Owner.SlackChannel.Name) - checklists1.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.SlackChannelID) - } - checklists1.Owner.Slug = types.StringPointerValue(checklistsItem.Owner.Slug) - if checklistsItem.Owner.UpdatedAt != nil { - checklists1.Owner.UpdatedAt = types.StringValue(checklistsItem.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.UpdatedAt = types.StringNull() - } - } - if checklistsItem.UpdatedAt != nil { - checklists1.UpdatedAt = types.StringValue(checklistsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.UpdatedAt = types.StringNull() - } - if checklistsCount+1 > len(r.ConnectedService.Checklists) { - r.ConnectedService.Checklists = append(r.ConnectedService.Checklists, checklists1) - } else { - r.ConnectedService.Checklists[checklistsCount].Checks = checklists1.Checks - r.ConnectedService.Checklists[checklistsCount].CreatedAt = checklists1.CreatedAt - r.ConnectedService.Checklists[checklistsCount].Description = checklists1.Description - r.ConnectedService.Checklists[checklistsCount].ID = checklists1.ID - r.ConnectedService.Checklists[checklistsCount].Name = checklists1.Name - r.ConnectedService.Checklists[checklistsCount].Owner = checklists1.Owner - r.ConnectedService.Checklists[checklistsCount].UpdatedAt = checklists1.UpdatedAt - } - } - if resp.ConnectedService.CompletedChecks != nil { - r.ConnectedService.CompletedChecks = types.Int64Value(int64(*resp.ConnectedService.CompletedChecks)) - } else { - r.ConnectedService.CompletedChecks = types.Int64Null() - } - if resp.ConnectedService.CreatedAt != nil { - r.ConnectedService.CreatedAt = types.StringValue(resp.ConnectedService.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.CreatedAt = types.StringNull() - } - r.ConnectedService.Description = types.StringPointerValue(resp.ConnectedService.Description) - r.ConnectedService.ExternalResources = []tfTypes.ExternalResourceEntity{} - if len(r.ConnectedService.ExternalResources) > len(resp.ConnectedService.ExternalResources) { - r.ConnectedService.ExternalResources = r.ConnectedService.ExternalResources[:len(resp.ConnectedService.ExternalResources)] - } - for externalResourcesCount2, externalResourcesItem2 := range resp.ConnectedService.ExternalResources { - var externalResources5 tfTypes.ExternalResourceEntity - externalResources5.ConnectionID = types.StringPointerValue(externalResourcesItem2.ConnectionID) - externalResources5.ConnectionName = types.StringPointerValue(externalResourcesItem2.ConnectionName) - externalResources5.ConnectionType = types.StringPointerValue(externalResourcesItem2.ConnectionType) - if externalResourcesItem2.CreatedAt != nil { - externalResources5.CreatedAt = types.StringValue(externalResourcesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.CreatedAt = types.StringNull() - } - externalResources5.Name = types.StringPointerValue(externalResourcesItem2.Name) - externalResources5.RemoteID = types.StringPointerValue(externalResourcesItem2.RemoteID) - externalResources5.RemoteURL = types.StringPointerValue(externalResourcesItem2.RemoteURL) - if externalResourcesItem2.UpdatedAt != nil { - externalResources5.UpdatedAt = types.StringValue(externalResourcesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.UpdatedAt = types.StringNull() - } - if externalResourcesCount2+1 > len(r.ConnectedService.ExternalResources) { - r.ConnectedService.ExternalResources = append(r.ConnectedService.ExternalResources, externalResources5) - } else { - r.ConnectedService.ExternalResources[externalResourcesCount2].ConnectionID = externalResources5.ConnectionID - r.ConnectedService.ExternalResources[externalResourcesCount2].ConnectionName = externalResources5.ConnectionName - r.ConnectedService.ExternalResources[externalResourcesCount2].ConnectionType = externalResources5.ConnectionType - r.ConnectedService.ExternalResources[externalResourcesCount2].CreatedAt = externalResources5.CreatedAt - r.ConnectedService.ExternalResources[externalResourcesCount2].Name = externalResources5.Name - r.ConnectedService.ExternalResources[externalResourcesCount2].RemoteID = externalResources5.RemoteID - r.ConnectedService.ExternalResources[externalResourcesCount2].RemoteURL = externalResources5.RemoteURL - r.ConnectedService.ExternalResources[externalResourcesCount2].UpdatedAt = externalResources5.UpdatedAt - } - } - r.ConnectedService.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.ConnectedService.Functionalities) > len(resp.ConnectedService.Functionalities) { - r.ConnectedService.Functionalities = r.ConnectedService.Functionalities[:len(resp.ConnectedService.Functionalities)] - } - for functionalitiesCount1, functionalitiesItem1 := range resp.ConnectedService.Functionalities { - var functionalities3 tfTypes.FunctionalityEntity - functionalities3.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem1.ActiveIncidents { - functionalities3.ActiveIncidents = append(functionalities3.ActiveIncidents, types.StringValue(v)) - } - functionalities3.AlertOnAdd = types.BoolPointerValue(functionalitiesItem1.AlertOnAdd) - functionalities3.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem1.AutoAddRespondingTeam) - if functionalitiesItem1.CreatedAt != nil { - functionalities3.CreatedAt = types.StringValue(functionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.CreatedAt = types.StringNull() - } - functionalities3.Description = types.StringPointerValue(functionalitiesItem1.Description) - functionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount3, externalResourcesItem3 := range functionalitiesItem1.ExternalResources { - var externalResources7 tfTypes.ExternalResourceEntity - externalResources7.ConnectionID = types.StringPointerValue(externalResourcesItem3.ConnectionID) - externalResources7.ConnectionName = types.StringPointerValue(externalResourcesItem3.ConnectionName) - externalResources7.ConnectionType = types.StringPointerValue(externalResourcesItem3.ConnectionType) - if externalResourcesItem3.CreatedAt != nil { - externalResources7.CreatedAt = types.StringValue(externalResourcesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.CreatedAt = types.StringNull() - } - externalResources7.Name = types.StringPointerValue(externalResourcesItem3.Name) - externalResources7.RemoteID = types.StringPointerValue(externalResourcesItem3.RemoteID) - externalResources7.RemoteURL = types.StringPointerValue(externalResourcesItem3.RemoteURL) - if externalResourcesItem3.UpdatedAt != nil { - externalResources7.UpdatedAt = types.StringValue(externalResourcesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.UpdatedAt = types.StringNull() - } - if externalResourcesCount3+1 > len(functionalities3.ExternalResources) { - functionalities3.ExternalResources = append(functionalities3.ExternalResources, externalResources7) - } else { - functionalities3.ExternalResources[externalResourcesCount3].ConnectionID = externalResources7.ConnectionID - functionalities3.ExternalResources[externalResourcesCount3].ConnectionName = externalResources7.ConnectionName - functionalities3.ExternalResources[externalResourcesCount3].ConnectionType = externalResources7.ConnectionType - functionalities3.ExternalResources[externalResourcesCount3].CreatedAt = externalResources7.CreatedAt - functionalities3.ExternalResources[externalResourcesCount3].Name = externalResources7.Name - functionalities3.ExternalResources[externalResourcesCount3].RemoteID = externalResources7.RemoteID - functionalities3.ExternalResources[externalResourcesCount3].RemoteURL = externalResources7.RemoteURL - functionalities3.ExternalResources[externalResourcesCount3].UpdatedAt = externalResources7.UpdatedAt - } - } - functionalities3.ID = types.StringPointerValue(functionalitiesItem1.ID) - if len(functionalitiesItem1.Labels) > 0 { - functionalities3.Labels = make(map[string]types.String) - for key2, value3 := range functionalitiesItem1.Labels { - functionalities3.Labels[key2] = types.StringValue(value3) - } - } - functionalities3.Links = []tfTypes.LinksEntity{} - for linksCount2, linksItem2 := range functionalitiesItem1.Links { - var links5 tfTypes.LinksEntity - links5.HrefURL = types.StringPointerValue(linksItem2.HrefURL) - links5.IconURL = types.StringPointerValue(linksItem2.IconURL) - links5.ID = types.StringPointerValue(linksItem2.ID) - links5.Name = types.StringPointerValue(linksItem2.Name) - if linksCount2+1 > len(functionalities3.Links) { - functionalities3.Links = append(functionalities3.Links, links5) - } else { - functionalities3.Links[linksCount2].HrefURL = links5.HrefURL - functionalities3.Links[linksCount2].IconURL = links5.IconURL - functionalities3.Links[linksCount2].ID = links5.ID - functionalities3.Links[linksCount2].Name = links5.Name - } - } - functionalities3.Name = types.StringPointerValue(functionalitiesItem1.Name) - if functionalitiesItem1.Owner == nil { - functionalities3.Owner = nil - } else { - functionalities3.Owner = &tfTypes.TeamEntity1{} - } - functionalities3.Slug = types.StringPointerValue(functionalitiesItem1.Slug) - if functionalitiesItem1.UpdatedAt != nil { - functionalities3.UpdatedAt = types.StringValue(functionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.UpdatedAt = types.StringNull() - } - if functionalitiesItem1.UpdatedBy == nil { - functionalities3.UpdatedBy = nil - } else { - functionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities3.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Email) - functionalities3.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem1.UpdatedBy.ID) - functionalities3.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Name) - functionalities3.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Source) - } - if functionalitiesCount1+1 > len(r.ConnectedService.Functionalities) { - r.ConnectedService.Functionalities = append(r.ConnectedService.Functionalities, functionalities3) - } else { - r.ConnectedService.Functionalities[functionalitiesCount1].ActiveIncidents = functionalities3.ActiveIncidents - r.ConnectedService.Functionalities[functionalitiesCount1].AlertOnAdd = functionalities3.AlertOnAdd - r.ConnectedService.Functionalities[functionalitiesCount1].AutoAddRespondingTeam = functionalities3.AutoAddRespondingTeam - r.ConnectedService.Functionalities[functionalitiesCount1].CreatedAt = functionalities3.CreatedAt - r.ConnectedService.Functionalities[functionalitiesCount1].Description = functionalities3.Description - r.ConnectedService.Functionalities[functionalitiesCount1].ExternalResources = functionalities3.ExternalResources - r.ConnectedService.Functionalities[functionalitiesCount1].ID = functionalities3.ID - r.ConnectedService.Functionalities[functionalitiesCount1].Labels = functionalities3.Labels - r.ConnectedService.Functionalities[functionalitiesCount1].Links = functionalities3.Links - r.ConnectedService.Functionalities[functionalitiesCount1].Name = functionalities3.Name - r.ConnectedService.Functionalities[functionalitiesCount1].Owner = functionalities3.Owner - r.ConnectedService.Functionalities[functionalitiesCount1].Slug = functionalities3.Slug - r.ConnectedService.Functionalities[functionalitiesCount1].UpdatedAt = functionalities3.UpdatedAt - r.ConnectedService.Functionalities[functionalitiesCount1].UpdatedBy = functionalities3.UpdatedBy - } - } - r.ConnectedService.ID = types.StringPointerValue(resp.ConnectedService.ID) - if len(resp.ConnectedService.Labels) > 0 { - r.ConnectedService.Labels = make(map[string]types.String) - for key3, value4 := range resp.ConnectedService.Labels { - r.ConnectedService.Labels[key3] = types.StringValue(value4) - } - } - if resp.ConnectedService.LastImport == nil { - r.ConnectedService.LastImport = nil - } else { - r.ConnectedService.LastImport = &tfTypes.ImportsImportableResourceEntity{} - r.ConnectedService.LastImport.ImportErrors = []tfTypes.ImportsImportErrorEntity{} - if len(r.ConnectedService.LastImport.ImportErrors) > len(resp.ConnectedService.LastImport.ImportErrors) { - r.ConnectedService.LastImport.ImportErrors = r.ConnectedService.LastImport.ImportErrors[:len(resp.ConnectedService.LastImport.ImportErrors)] - } - for importErrorsCount, importErrorsItem := range resp.ConnectedService.LastImport.ImportErrors { - var importErrors1 tfTypes.ImportsImportErrorEntity - if importErrorsItem.CreatedAt != nil { - importErrors1.CreatedAt = types.StringValue(importErrorsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - importErrors1.CreatedAt = types.StringNull() - } - if importErrorsItem.Data == nil { - importErrors1.Data = nil - } else { - importErrors1.Data = &tfTypes.TeamEntity1{} - } - importErrors1.ID = types.StringPointerValue(importErrorsItem.ID) - importErrors1.Message = types.StringPointerValue(importErrorsItem.Message) - if importErrorsItem.Resource == nil { - importErrors1.Resource = nil - } else { - importErrors1.Resource = &tfTypes.ImportsImportErrorEntityResourceEntity{} - importErrors1.Resource.Name = types.StringPointerValue(importErrorsItem.Resource.Name) - importErrors1.Resource.ResourceID = types.StringPointerValue(importErrorsItem.Resource.ResourceID) - importErrors1.Resource.ResourceType = types.StringPointerValue(importErrorsItem.Resource.ResourceType) - } - if importErrorsCount+1 > len(r.ConnectedService.LastImport.ImportErrors) { - r.ConnectedService.LastImport.ImportErrors = append(r.ConnectedService.LastImport.ImportErrors, importErrors1) - } else { - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].CreatedAt = importErrors1.CreatedAt - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].Data = importErrors1.Data - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].ID = importErrors1.ID - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].Message = importErrors1.Message - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].Resource = importErrors1.Resource - } - } - if resp.ConnectedService.LastImport.ImportedAt != nil { - r.ConnectedService.LastImport.ImportedAt = types.StringValue(resp.ConnectedService.LastImport.ImportedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.LastImport.ImportedAt = types.StringNull() - } - r.ConnectedService.LastImport.RemoteID = types.StringPointerValue(resp.ConnectedService.LastImport.RemoteID) - if resp.ConnectedService.LastImport.State != nil { - r.ConnectedService.LastImport.State = types.StringValue(string(*resp.ConnectedService.LastImport.State)) - } else { - r.ConnectedService.LastImport.State = types.StringNull() - } - } - r.ConnectedService.Links = []tfTypes.LinksEntity{} - if len(r.ConnectedService.Links) > len(resp.ConnectedService.Links) { - r.ConnectedService.Links = r.ConnectedService.Links[:len(resp.ConnectedService.Links)] - } - for linksCount3, linksItem3 := range resp.ConnectedService.Links { - var links7 tfTypes.LinksEntity - links7.HrefURL = types.StringPointerValue(linksItem3.HrefURL) - links7.IconURL = types.StringPointerValue(linksItem3.IconURL) - links7.ID = types.StringPointerValue(linksItem3.ID) - links7.Name = types.StringPointerValue(linksItem3.Name) - if linksCount3+1 > len(r.ConnectedService.Links) { - r.ConnectedService.Links = append(r.ConnectedService.Links, links7) - } else { - r.ConnectedService.Links[linksCount3].HrefURL = links7.HrefURL - r.ConnectedService.Links[linksCount3].IconURL = links7.IconURL - r.ConnectedService.Links[linksCount3].ID = links7.ID - r.ConnectedService.Links[linksCount3].Name = links7.Name - } - } - r.ConnectedService.ManagedBy = types.StringPointerValue(resp.ConnectedService.ManagedBy) - if resp.ConnectedService.ManagedBySettings == nil { - r.ConnectedService.ManagedBySettings = nil - } else { - r.ConnectedService.ManagedBySettings = &tfTypes.TeamEntity1{} - } - r.ConnectedService.Name = types.StringPointerValue(resp.ConnectedService.Name) - if resp.ConnectedService.Owner == nil { - r.ConnectedService.Owner = nil - } else { - r.ConnectedService.Owner = &tfTypes.TeamEntity{} - if resp.ConnectedService.Owner.CreatedAt != nil { - r.ConnectedService.Owner.CreatedAt = types.StringValue(resp.ConnectedService.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.Owner.CreatedAt = types.StringNull() - } - if resp.ConnectedService.Owner.CreatedBy == nil { - r.ConnectedService.Owner.CreatedBy = nil - } else { - r.ConnectedService.Owner.CreatedBy = &tfTypes.AuthorEntity{} - r.ConnectedService.Owner.CreatedBy.Email = types.StringPointerValue(resp.ConnectedService.Owner.CreatedBy.Email) - r.ConnectedService.Owner.CreatedBy.ID = types.StringPointerValue(resp.ConnectedService.Owner.CreatedBy.ID) - r.ConnectedService.Owner.CreatedBy.Name = types.StringPointerValue(resp.ConnectedService.Owner.CreatedBy.Name) - r.ConnectedService.Owner.CreatedBy.Source = types.StringPointerValue(resp.ConnectedService.Owner.CreatedBy.Source) - } - r.ConnectedService.Owner.Description = types.StringPointerValue(resp.ConnectedService.Owner.Description) - r.ConnectedService.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.ConnectedService.Owner.Functionalities) > len(resp.ConnectedService.Owner.Functionalities) { - r.ConnectedService.Owner.Functionalities = r.ConnectedService.Owner.Functionalities[:len(resp.ConnectedService.Owner.Functionalities)] - } - for functionalitiesCount2, functionalitiesItem2 := range resp.ConnectedService.Owner.Functionalities { - var functionalities5 tfTypes.FunctionalityEntity - functionalities5.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem2.ActiveIncidents { - functionalities5.ActiveIncidents = append(functionalities5.ActiveIncidents, types.StringValue(v)) - } - functionalities5.AlertOnAdd = types.BoolPointerValue(functionalitiesItem2.AlertOnAdd) - functionalities5.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem2.AutoAddRespondingTeam) - if functionalitiesItem2.CreatedAt != nil { - functionalities5.CreatedAt = types.StringValue(functionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.CreatedAt = types.StringNull() - } - functionalities5.Description = types.StringPointerValue(functionalitiesItem2.Description) - functionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount4, externalResourcesItem4 := range functionalitiesItem2.ExternalResources { - var externalResources9 tfTypes.ExternalResourceEntity - externalResources9.ConnectionID = types.StringPointerValue(externalResourcesItem4.ConnectionID) - externalResources9.ConnectionName = types.StringPointerValue(externalResourcesItem4.ConnectionName) - externalResources9.ConnectionType = types.StringPointerValue(externalResourcesItem4.ConnectionType) - if externalResourcesItem4.CreatedAt != nil { - externalResources9.CreatedAt = types.StringValue(externalResourcesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.CreatedAt = types.StringNull() - } - externalResources9.Name = types.StringPointerValue(externalResourcesItem4.Name) - externalResources9.RemoteID = types.StringPointerValue(externalResourcesItem4.RemoteID) - externalResources9.RemoteURL = types.StringPointerValue(externalResourcesItem4.RemoteURL) - if externalResourcesItem4.UpdatedAt != nil { - externalResources9.UpdatedAt = types.StringValue(externalResourcesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.UpdatedAt = types.StringNull() - } - if externalResourcesCount4+1 > len(functionalities5.ExternalResources) { - functionalities5.ExternalResources = append(functionalities5.ExternalResources, externalResources9) - } else { - functionalities5.ExternalResources[externalResourcesCount4].ConnectionID = externalResources9.ConnectionID - functionalities5.ExternalResources[externalResourcesCount4].ConnectionName = externalResources9.ConnectionName - functionalities5.ExternalResources[externalResourcesCount4].ConnectionType = externalResources9.ConnectionType - functionalities5.ExternalResources[externalResourcesCount4].CreatedAt = externalResources9.CreatedAt - functionalities5.ExternalResources[externalResourcesCount4].Name = externalResources9.Name - functionalities5.ExternalResources[externalResourcesCount4].RemoteID = externalResources9.RemoteID - functionalities5.ExternalResources[externalResourcesCount4].RemoteURL = externalResources9.RemoteURL - functionalities5.ExternalResources[externalResourcesCount4].UpdatedAt = externalResources9.UpdatedAt - } - } - functionalities5.ID = types.StringPointerValue(functionalitiesItem2.ID) - if len(functionalitiesItem2.Labels) > 0 { - functionalities5.Labels = make(map[string]types.String) - for key4, value5 := range functionalitiesItem2.Labels { - functionalities5.Labels[key4] = types.StringValue(value5) - } - } - functionalities5.Links = []tfTypes.LinksEntity{} - for linksCount4, linksItem4 := range functionalitiesItem2.Links { - var links9 tfTypes.LinksEntity - links9.HrefURL = types.StringPointerValue(linksItem4.HrefURL) - links9.IconURL = types.StringPointerValue(linksItem4.IconURL) - links9.ID = types.StringPointerValue(linksItem4.ID) - links9.Name = types.StringPointerValue(linksItem4.Name) - if linksCount4+1 > len(functionalities5.Links) { - functionalities5.Links = append(functionalities5.Links, links9) - } else { - functionalities5.Links[linksCount4].HrefURL = links9.HrefURL - functionalities5.Links[linksCount4].IconURL = links9.IconURL - functionalities5.Links[linksCount4].ID = links9.ID - functionalities5.Links[linksCount4].Name = links9.Name - } - } - functionalities5.Name = types.StringPointerValue(functionalitiesItem2.Name) - if functionalitiesItem2.Owner == nil { - functionalities5.Owner = nil - } else { - functionalities5.Owner = &tfTypes.TeamEntity1{} - } - functionalities5.Slug = types.StringPointerValue(functionalitiesItem2.Slug) - if functionalitiesItem2.UpdatedAt != nil { - functionalities5.UpdatedAt = types.StringValue(functionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.UpdatedAt = types.StringNull() - } - if functionalitiesItem2.UpdatedBy == nil { - functionalities5.UpdatedBy = nil - } else { - functionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities5.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Email) - functionalities5.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem2.UpdatedBy.ID) - functionalities5.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Name) - functionalities5.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Source) - } - if functionalitiesCount2+1 > len(r.ConnectedService.Owner.Functionalities) { - r.ConnectedService.Owner.Functionalities = append(r.ConnectedService.Owner.Functionalities, functionalities5) - } else { - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].ActiveIncidents = functionalities5.ActiveIncidents - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].AlertOnAdd = functionalities5.AlertOnAdd - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].AutoAddRespondingTeam = functionalities5.AutoAddRespondingTeam - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].CreatedAt = functionalities5.CreatedAt - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Description = functionalities5.Description - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].ExternalResources = functionalities5.ExternalResources - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].ID = functionalities5.ID - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Labels = functionalities5.Labels - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Links = functionalities5.Links - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Name = functionalities5.Name - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Owner = functionalities5.Owner - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Slug = functionalities5.Slug - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].UpdatedAt = functionalities5.UpdatedAt - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].UpdatedBy = functionalities5.UpdatedBy - } - } - r.ConnectedService.Owner.ID = types.StringPointerValue(resp.ConnectedService.Owner.ID) - r.ConnectedService.Owner.Memberships = []tfTypes.MembershipEntity{} - if len(r.ConnectedService.Owner.Memberships) > len(resp.ConnectedService.Owner.Memberships) { - r.ConnectedService.Owner.Memberships = r.ConnectedService.Owner.Memberships[:len(resp.ConnectedService.Owner.Memberships)] - } - for membershipsCount1, membershipsItem1 := range resp.ConnectedService.Owner.Memberships { - var memberships3 tfTypes.MembershipEntity - if membershipsItem1.DefaultIncidentRole == nil { - memberships3.DefaultIncidentRole = nil - } else { - memberships3.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem1.DefaultIncidentRole.CreatedAt != nil { - memberships3.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Description) - if membershipsItem1.DefaultIncidentRole.DiscardedAt != nil { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.ID) - memberships3.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Name) - memberships3.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Summary) - if membershipsItem1.DefaultIncidentRole.UpdatedAt != nil { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem1.Schedule == nil { - memberships3.Schedule = nil - } else { - memberships3.Schedule = &tfTypes.ScheduleEntity{} - memberships3.Schedule.Discarded = types.BoolPointerValue(membershipsItem1.Schedule.Discarded) - memberships3.Schedule.ID = types.StringPointerValue(membershipsItem1.Schedule.ID) - memberships3.Schedule.Integration = types.StringPointerValue(membershipsItem1.Schedule.Integration) - memberships3.Schedule.Name = types.StringPointerValue(membershipsItem1.Schedule.Name) - } - if membershipsItem1.User == nil { - memberships3.User = nil - } else { - memberships3.User = &tfTypes.UserEntity{} - if membershipsItem1.User.CreatedAt != nil { - memberships3.User.CreatedAt = types.StringValue(membershipsItem1.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.CreatedAt = types.StringNull() - } - memberships3.User.Email = types.StringPointerValue(membershipsItem1.User.Email) - memberships3.User.ID = types.StringPointerValue(membershipsItem1.User.ID) - memberships3.User.Name = types.StringPointerValue(membershipsItem1.User.Name) - memberships3.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem1.User.SignalsEnabledNotificationTypes { - memberships3.User.SignalsEnabledNotificationTypes = append(memberships3.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships3.User.SlackLinked = types.BoolPointerValue(membershipsItem1.User.SlackLinked) - memberships3.User.SlackUserID = types.StringPointerValue(membershipsItem1.User.SlackUserID) - if membershipsItem1.User.UpdatedAt != nil { - memberships3.User.UpdatedAt = types.StringValue(membershipsItem1.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount1+1 > len(r.ConnectedService.Owner.Memberships) { - r.ConnectedService.Owner.Memberships = append(r.ConnectedService.Owner.Memberships, memberships3) - } else { - r.ConnectedService.Owner.Memberships[membershipsCount1].DefaultIncidentRole = memberships3.DefaultIncidentRole - r.ConnectedService.Owner.Memberships[membershipsCount1].Schedule = memberships3.Schedule - r.ConnectedService.Owner.Memberships[membershipsCount1].User = memberships3.User - } - } - if resp.ConnectedService.Owner.MsTeamsChannel == nil { - r.ConnectedService.Owner.MsTeamsChannel = nil - } else { - r.ConnectedService.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.ConnectedService.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.ChannelID) - r.ConnectedService.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.ChannelName) - r.ConnectedService.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.ChannelURL) - r.ConnectedService.Owner.MsTeamsChannel.ID = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.ID) - r.ConnectedService.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.MsTeamID) - r.ConnectedService.Owner.MsTeamsChannel.Status = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.Status) - r.ConnectedService.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.TeamName) - } - r.ConnectedService.Owner.Name = types.StringPointerValue(resp.ConnectedService.Owner.Name) - r.ConnectedService.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.ConnectedService.Owner.OwnedFunctionalities) > len(resp.ConnectedService.Owner.OwnedFunctionalities) { - r.ConnectedService.Owner.OwnedFunctionalities = r.ConnectedService.Owner.OwnedFunctionalities[:len(resp.ConnectedService.Owner.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount1, ownedFunctionalitiesItem1 := range resp.ConnectedService.Owner.OwnedFunctionalities { - var ownedFunctionalities3 tfTypes.FunctionalityEntity - ownedFunctionalities3.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem1.ActiveIncidents { - ownedFunctionalities3.ActiveIncidents = append(ownedFunctionalities3.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities3.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem1.AlertOnAdd) - ownedFunctionalities3.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem1.AutoAddRespondingTeam) - if ownedFunctionalitiesItem1.CreatedAt != nil { - ownedFunctionalities3.CreatedAt = types.StringValue(ownedFunctionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.CreatedAt = types.StringNull() - } - ownedFunctionalities3.Description = types.StringPointerValue(ownedFunctionalitiesItem1.Description) - ownedFunctionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount5, externalResourcesItem5 := range ownedFunctionalitiesItem1.ExternalResources { - var externalResources11 tfTypes.ExternalResourceEntity - externalResources11.ConnectionID = types.StringPointerValue(externalResourcesItem5.ConnectionID) - externalResources11.ConnectionName = types.StringPointerValue(externalResourcesItem5.ConnectionName) - externalResources11.ConnectionType = types.StringPointerValue(externalResourcesItem5.ConnectionType) - if externalResourcesItem5.CreatedAt != nil { - externalResources11.CreatedAt = types.StringValue(externalResourcesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.CreatedAt = types.StringNull() - } - externalResources11.Name = types.StringPointerValue(externalResourcesItem5.Name) - externalResources11.RemoteID = types.StringPointerValue(externalResourcesItem5.RemoteID) - externalResources11.RemoteURL = types.StringPointerValue(externalResourcesItem5.RemoteURL) - if externalResourcesItem5.UpdatedAt != nil { - externalResources11.UpdatedAt = types.StringValue(externalResourcesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.UpdatedAt = types.StringNull() - } - if externalResourcesCount5+1 > len(ownedFunctionalities3.ExternalResources) { - ownedFunctionalities3.ExternalResources = append(ownedFunctionalities3.ExternalResources, externalResources11) - } else { - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionID = externalResources11.ConnectionID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionName = externalResources11.ConnectionName - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionType = externalResources11.ConnectionType - ownedFunctionalities3.ExternalResources[externalResourcesCount5].CreatedAt = externalResources11.CreatedAt - ownedFunctionalities3.ExternalResources[externalResourcesCount5].Name = externalResources11.Name - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteID = externalResources11.RemoteID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteURL = externalResources11.RemoteURL - ownedFunctionalities3.ExternalResources[externalResourcesCount5].UpdatedAt = externalResources11.UpdatedAt - } - } - ownedFunctionalities3.ID = types.StringPointerValue(ownedFunctionalitiesItem1.ID) - if len(ownedFunctionalitiesItem1.Labels) > 0 { - ownedFunctionalities3.Labels = make(map[string]types.String) - for key5, value6 := range ownedFunctionalitiesItem1.Labels { - ownedFunctionalities3.Labels[key5] = types.StringValue(value6) - } - } - ownedFunctionalities3.Links = []tfTypes.LinksEntity{} - for linksCount5, linksItem5 := range ownedFunctionalitiesItem1.Links { - var links11 tfTypes.LinksEntity - links11.HrefURL = types.StringPointerValue(linksItem5.HrefURL) - links11.IconURL = types.StringPointerValue(linksItem5.IconURL) - links11.ID = types.StringPointerValue(linksItem5.ID) - links11.Name = types.StringPointerValue(linksItem5.Name) - if linksCount5+1 > len(ownedFunctionalities3.Links) { - ownedFunctionalities3.Links = append(ownedFunctionalities3.Links, links11) - } else { - ownedFunctionalities3.Links[linksCount5].HrefURL = links11.HrefURL - ownedFunctionalities3.Links[linksCount5].IconURL = links11.IconURL - ownedFunctionalities3.Links[linksCount5].ID = links11.ID - ownedFunctionalities3.Links[linksCount5].Name = links11.Name - } - } - ownedFunctionalities3.Name = types.StringPointerValue(ownedFunctionalitiesItem1.Name) - if ownedFunctionalitiesItem1.Owner == nil { - ownedFunctionalities3.Owner = nil - } else { - ownedFunctionalities3.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities3.Slug = types.StringPointerValue(ownedFunctionalitiesItem1.Slug) - if ownedFunctionalitiesItem1.UpdatedAt != nil { - ownedFunctionalities3.UpdatedAt = types.StringValue(ownedFunctionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem1.UpdatedBy == nil { - ownedFunctionalities3.UpdatedBy = nil - } else { - ownedFunctionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities3.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Email) - ownedFunctionalities3.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.ID) - ownedFunctionalities3.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Name) - ownedFunctionalities3.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Source) - } - if ownedFunctionalitiesCount1+1 > len(r.ConnectedService.Owner.OwnedFunctionalities) { - r.ConnectedService.Owner.OwnedFunctionalities = append(r.ConnectedService.Owner.OwnedFunctionalities, ownedFunctionalities3) - } else { - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ActiveIncidents = ownedFunctionalities3.ActiveIncidents - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AlertOnAdd = ownedFunctionalities3.AlertOnAdd - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AutoAddRespondingTeam = ownedFunctionalities3.AutoAddRespondingTeam - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].CreatedAt = ownedFunctionalities3.CreatedAt - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Description = ownedFunctionalities3.Description - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ExternalResources = ownedFunctionalities3.ExternalResources - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ID = ownedFunctionalities3.ID - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Labels = ownedFunctionalities3.Labels - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Links = ownedFunctionalities3.Links - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Name = ownedFunctionalities3.Name - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Owner = ownedFunctionalities3.Owner - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Slug = ownedFunctionalities3.Slug - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedAt = ownedFunctionalities3.UpdatedAt - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedBy = ownedFunctionalities3.UpdatedBy - } - } - r.ConnectedService.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.ConnectedService.Owner.OwnedRunbooks) > len(resp.ConnectedService.Owner.OwnedRunbooks) { - r.ConnectedService.Owner.OwnedRunbooks = r.ConnectedService.Owner.OwnedRunbooks[:len(resp.ConnectedService.Owner.OwnedRunbooks)] - } - for ownedRunbooksCount1, ownedRunbooksItem1 := range resp.ConnectedService.Owner.OwnedRunbooks { - var ownedRunbooks3 tfTypes.SlimRunbookEntity - if ownedRunbooksItem1.AttachmentRule == nil { - ownedRunbooks3.AttachmentRule = nil - } else { - ownedRunbooks3.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem1.AttachmentRule.Logic == nil { - ownedRunbooks3.AttachmentRule.Logic = nil - } else { - ownedRunbooks3.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem1.AttachmentRule.UserData == nil { - ownedRunbooks3.AttachmentRule.UserData = nil - } else { - ownedRunbooks3.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks3.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Label) - ownedRunbooks3.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Type) - ownedRunbooks3.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Value) - } - } - ownedRunbooks3.Categories = types.StringPointerValue(ownedRunbooksItem1.Categories) - if ownedRunbooksItem1.CreatedAt != nil { - ownedRunbooks3.CreatedAt = types.StringValue(ownedRunbooksItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.CreatedAt = types.StringNull() - } - ownedRunbooks3.Description = types.StringPointerValue(ownedRunbooksItem1.Description) - ownedRunbooks3.ID = types.StringPointerValue(ownedRunbooksItem1.ID) - ownedRunbooks3.Name = types.StringPointerValue(ownedRunbooksItem1.Name) - if ownedRunbooksItem1.Owner == nil { - ownedRunbooks3.Owner = nil - } else { - ownedRunbooks3.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks3.Summary = types.StringPointerValue(ownedRunbooksItem1.Summary) - ownedRunbooks3.Type = types.StringPointerValue(ownedRunbooksItem1.Type) - if ownedRunbooksItem1.UpdatedAt != nil { - ownedRunbooks3.UpdatedAt = types.StringValue(ownedRunbooksItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount1+1 > len(r.ConnectedService.Owner.OwnedRunbooks) { - r.ConnectedService.Owner.OwnedRunbooks = append(r.ConnectedService.Owner.OwnedRunbooks, ownedRunbooks3) - } else { - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].AttachmentRule = ownedRunbooks3.AttachmentRule - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Categories = ownedRunbooks3.Categories - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].CreatedAt = ownedRunbooks3.CreatedAt - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Description = ownedRunbooks3.Description - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].ID = ownedRunbooks3.ID - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Name = ownedRunbooks3.Name - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Owner = ownedRunbooks3.Owner - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Summary = ownedRunbooks3.Summary - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Type = ownedRunbooks3.Type - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].UpdatedAt = ownedRunbooks3.UpdatedAt - } - } - r.ConnectedService.Owner.SignalsIcalURL = types.StringPointerValue(resp.ConnectedService.Owner.SignalsIcalURL) - if resp.ConnectedService.Owner.SlackChannel == nil { - r.ConnectedService.Owner.SlackChannel = nil - } else { - r.ConnectedService.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.ConnectedService.Owner.SlackChannel.ID = types.StringPointerValue(resp.ConnectedService.Owner.SlackChannel.ID) - r.ConnectedService.Owner.SlackChannel.Name = types.StringPointerValue(resp.ConnectedService.Owner.SlackChannel.Name) - r.ConnectedService.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(resp.ConnectedService.Owner.SlackChannel.SlackChannelID) - } - r.ConnectedService.Owner.Slug = types.StringPointerValue(resp.ConnectedService.Owner.Slug) - if resp.ConnectedService.Owner.UpdatedAt != nil { - r.ConnectedService.Owner.UpdatedAt = types.StringValue(resp.ConnectedService.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.Owner.UpdatedAt = types.StringNull() - } - } - if resp.ConnectedService.ServiceChecklistUpdatedAt != nil { - r.ConnectedService.ServiceChecklistUpdatedAt = types.StringValue(resp.ConnectedService.ServiceChecklistUpdatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.ServiceChecklistUpdatedAt = types.StringNull() - } - if resp.ConnectedService.ServiceTier != nil { - r.ConnectedService.ServiceTier = types.Int64Value(int64(*resp.ConnectedService.ServiceTier)) - } else { - r.ConnectedService.ServiceTier = types.Int64Null() - } - r.ConnectedService.Slug = types.StringPointerValue(resp.ConnectedService.Slug) - r.ConnectedService.Teams = []tfTypes.TeamEntity{} - if len(r.ConnectedService.Teams) > len(resp.ConnectedService.Teams) { - r.ConnectedService.Teams = r.ConnectedService.Teams[:len(resp.ConnectedService.Teams)] - } - for teamsCount, teamsItem := range resp.ConnectedService.Teams { - var teams1 tfTypes.TeamEntity - if teamsItem.CreatedAt != nil { - teams1.CreatedAt = types.StringValue(teamsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams1.CreatedAt = types.StringNull() - } - if teamsItem.CreatedBy == nil { - teams1.CreatedBy = nil - } else { - teams1.CreatedBy = &tfTypes.AuthorEntity{} - teams1.CreatedBy.Email = types.StringPointerValue(teamsItem.CreatedBy.Email) - teams1.CreatedBy.ID = types.StringPointerValue(teamsItem.CreatedBy.ID) - teams1.CreatedBy.Name = types.StringPointerValue(teamsItem.CreatedBy.Name) - teams1.CreatedBy.Source = types.StringPointerValue(teamsItem.CreatedBy.Source) - } - teams1.Description = types.StringPointerValue(teamsItem.Description) - teams1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount3, functionalitiesItem3 := range teamsItem.Functionalities { - var functionalities7 tfTypes.FunctionalityEntity - functionalities7.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem3.ActiveIncidents { - functionalities7.ActiveIncidents = append(functionalities7.ActiveIncidents, types.StringValue(v)) - } - functionalities7.AlertOnAdd = types.BoolPointerValue(functionalitiesItem3.AlertOnAdd) - functionalities7.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem3.AutoAddRespondingTeam) - if functionalitiesItem3.CreatedAt != nil { - functionalities7.CreatedAt = types.StringValue(functionalitiesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.CreatedAt = types.StringNull() - } - functionalities7.Description = types.StringPointerValue(functionalitiesItem3.Description) - functionalities7.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount6, externalResourcesItem6 := range functionalitiesItem3.ExternalResources { - var externalResources13 tfTypes.ExternalResourceEntity - externalResources13.ConnectionID = types.StringPointerValue(externalResourcesItem6.ConnectionID) - externalResources13.ConnectionName = types.StringPointerValue(externalResourcesItem6.ConnectionName) - externalResources13.ConnectionType = types.StringPointerValue(externalResourcesItem6.ConnectionType) - if externalResourcesItem6.CreatedAt != nil { - externalResources13.CreatedAt = types.StringValue(externalResourcesItem6.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.CreatedAt = types.StringNull() - } - externalResources13.Name = types.StringPointerValue(externalResourcesItem6.Name) - externalResources13.RemoteID = types.StringPointerValue(externalResourcesItem6.RemoteID) - externalResources13.RemoteURL = types.StringPointerValue(externalResourcesItem6.RemoteURL) - if externalResourcesItem6.UpdatedAt != nil { - externalResources13.UpdatedAt = types.StringValue(externalResourcesItem6.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.UpdatedAt = types.StringNull() - } - if externalResourcesCount6+1 > len(functionalities7.ExternalResources) { - functionalities7.ExternalResources = append(functionalities7.ExternalResources, externalResources13) - } else { - functionalities7.ExternalResources[externalResourcesCount6].ConnectionID = externalResources13.ConnectionID - functionalities7.ExternalResources[externalResourcesCount6].ConnectionName = externalResources13.ConnectionName - functionalities7.ExternalResources[externalResourcesCount6].ConnectionType = externalResources13.ConnectionType - functionalities7.ExternalResources[externalResourcesCount6].CreatedAt = externalResources13.CreatedAt - functionalities7.ExternalResources[externalResourcesCount6].Name = externalResources13.Name - functionalities7.ExternalResources[externalResourcesCount6].RemoteID = externalResources13.RemoteID - functionalities7.ExternalResources[externalResourcesCount6].RemoteURL = externalResources13.RemoteURL - functionalities7.ExternalResources[externalResourcesCount6].UpdatedAt = externalResources13.UpdatedAt - } - } - functionalities7.ID = types.StringPointerValue(functionalitiesItem3.ID) - if len(functionalitiesItem3.Labels) > 0 { - functionalities7.Labels = make(map[string]types.String) - for key6, value8 := range functionalitiesItem3.Labels { - functionalities7.Labels[key6] = types.StringValue(value8) - } - } - functionalities7.Links = []tfTypes.LinksEntity{} - for linksCount6, linksItem6 := range functionalitiesItem3.Links { - var links13 tfTypes.LinksEntity - links13.HrefURL = types.StringPointerValue(linksItem6.HrefURL) - links13.IconURL = types.StringPointerValue(linksItem6.IconURL) - links13.ID = types.StringPointerValue(linksItem6.ID) - links13.Name = types.StringPointerValue(linksItem6.Name) - if linksCount6+1 > len(functionalities7.Links) { - functionalities7.Links = append(functionalities7.Links, links13) - } else { - functionalities7.Links[linksCount6].HrefURL = links13.HrefURL - functionalities7.Links[linksCount6].IconURL = links13.IconURL - functionalities7.Links[linksCount6].ID = links13.ID - functionalities7.Links[linksCount6].Name = links13.Name - } - } - functionalities7.Name = types.StringPointerValue(functionalitiesItem3.Name) - if functionalitiesItem3.Owner == nil { - functionalities7.Owner = nil - } else { - functionalities7.Owner = &tfTypes.TeamEntity1{} - } - functionalities7.Slug = types.StringPointerValue(functionalitiesItem3.Slug) - if functionalitiesItem3.UpdatedAt != nil { - functionalities7.UpdatedAt = types.StringValue(functionalitiesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.UpdatedAt = types.StringNull() - } - if functionalitiesItem3.UpdatedBy == nil { - functionalities7.UpdatedBy = nil - } else { - functionalities7.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities7.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Email) - functionalities7.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem3.UpdatedBy.ID) - functionalities7.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Name) - functionalities7.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Source) - } - if functionalitiesCount3+1 > len(teams1.Functionalities) { - teams1.Functionalities = append(teams1.Functionalities, functionalities7) - } else { - teams1.Functionalities[functionalitiesCount3].ActiveIncidents = functionalities7.ActiveIncidents - teams1.Functionalities[functionalitiesCount3].AlertOnAdd = functionalities7.AlertOnAdd - teams1.Functionalities[functionalitiesCount3].AutoAddRespondingTeam = functionalities7.AutoAddRespondingTeam - teams1.Functionalities[functionalitiesCount3].CreatedAt = functionalities7.CreatedAt - teams1.Functionalities[functionalitiesCount3].Description = functionalities7.Description - teams1.Functionalities[functionalitiesCount3].ExternalResources = functionalities7.ExternalResources - teams1.Functionalities[functionalitiesCount3].ID = functionalities7.ID - teams1.Functionalities[functionalitiesCount3].Labels = functionalities7.Labels - teams1.Functionalities[functionalitiesCount3].Links = functionalities7.Links - teams1.Functionalities[functionalitiesCount3].Name = functionalities7.Name - teams1.Functionalities[functionalitiesCount3].Owner = functionalities7.Owner - teams1.Functionalities[functionalitiesCount3].Slug = functionalities7.Slug - teams1.Functionalities[functionalitiesCount3].UpdatedAt = functionalities7.UpdatedAt - teams1.Functionalities[functionalitiesCount3].UpdatedBy = functionalities7.UpdatedBy - } - } - teams1.ID = types.StringPointerValue(teamsItem.ID) - teams1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount2, membershipsItem2 := range teamsItem.Memberships { - var memberships5 tfTypes.MembershipEntity - if membershipsItem2.DefaultIncidentRole == nil { - memberships5.DefaultIncidentRole = nil - } else { - memberships5.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem2.DefaultIncidentRole.CreatedAt != nil { - memberships5.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Description) - if membershipsItem2.DefaultIncidentRole.DiscardedAt != nil { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.ID) - memberships5.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Name) - memberships5.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Summary) - if membershipsItem2.DefaultIncidentRole.UpdatedAt != nil { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem2.Schedule == nil { - memberships5.Schedule = nil - } else { - memberships5.Schedule = &tfTypes.ScheduleEntity{} - memberships5.Schedule.Discarded = types.BoolPointerValue(membershipsItem2.Schedule.Discarded) - memberships5.Schedule.ID = types.StringPointerValue(membershipsItem2.Schedule.ID) - memberships5.Schedule.Integration = types.StringPointerValue(membershipsItem2.Schedule.Integration) - memberships5.Schedule.Name = types.StringPointerValue(membershipsItem2.Schedule.Name) - } - if membershipsItem2.User == nil { - memberships5.User = nil - } else { - memberships5.User = &tfTypes.UserEntity{} - if membershipsItem2.User.CreatedAt != nil { - memberships5.User.CreatedAt = types.StringValue(membershipsItem2.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.CreatedAt = types.StringNull() - } - memberships5.User.Email = types.StringPointerValue(membershipsItem2.User.Email) - memberships5.User.ID = types.StringPointerValue(membershipsItem2.User.ID) - memberships5.User.Name = types.StringPointerValue(membershipsItem2.User.Name) - memberships5.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem2.User.SignalsEnabledNotificationTypes { - memberships5.User.SignalsEnabledNotificationTypes = append(memberships5.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships5.User.SlackLinked = types.BoolPointerValue(membershipsItem2.User.SlackLinked) - memberships5.User.SlackUserID = types.StringPointerValue(membershipsItem2.User.SlackUserID) - if membershipsItem2.User.UpdatedAt != nil { - memberships5.User.UpdatedAt = types.StringValue(membershipsItem2.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount2+1 > len(teams1.Memberships) { - teams1.Memberships = append(teams1.Memberships, memberships5) - } else { - teams1.Memberships[membershipsCount2].DefaultIncidentRole = memberships5.DefaultIncidentRole - teams1.Memberships[membershipsCount2].Schedule = memberships5.Schedule - teams1.Memberships[membershipsCount2].User = memberships5.User - } - } - if teamsItem.MsTeamsChannel == nil { - teams1.MsTeamsChannel = nil - } else { - teams1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams1.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelID) - teams1.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelName) - teams1.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelURL) - teams1.MsTeamsChannel.ID = types.StringPointerValue(teamsItem.MsTeamsChannel.ID) - teams1.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem.MsTeamsChannel.MsTeamID) - teams1.MsTeamsChannel.Status = types.StringPointerValue(teamsItem.MsTeamsChannel.Status) - teams1.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem.MsTeamsChannel.TeamName) - } - teams1.Name = types.StringPointerValue(teamsItem.Name) - teams1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount2, ownedFunctionalitiesItem2 := range teamsItem.OwnedFunctionalities { - var ownedFunctionalities5 tfTypes.FunctionalityEntity - ownedFunctionalities5.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem2.ActiveIncidents { - ownedFunctionalities5.ActiveIncidents = append(ownedFunctionalities5.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities5.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem2.AlertOnAdd) - ownedFunctionalities5.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem2.AutoAddRespondingTeam) - if ownedFunctionalitiesItem2.CreatedAt != nil { - ownedFunctionalities5.CreatedAt = types.StringValue(ownedFunctionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.CreatedAt = types.StringNull() - } - ownedFunctionalities5.Description = types.StringPointerValue(ownedFunctionalitiesItem2.Description) - ownedFunctionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount7, externalResourcesItem7 := range ownedFunctionalitiesItem2.ExternalResources { - var externalResources15 tfTypes.ExternalResourceEntity - externalResources15.ConnectionID = types.StringPointerValue(externalResourcesItem7.ConnectionID) - externalResources15.ConnectionName = types.StringPointerValue(externalResourcesItem7.ConnectionName) - externalResources15.ConnectionType = types.StringPointerValue(externalResourcesItem7.ConnectionType) - if externalResourcesItem7.CreatedAt != nil { - externalResources15.CreatedAt = types.StringValue(externalResourcesItem7.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.CreatedAt = types.StringNull() - } - externalResources15.Name = types.StringPointerValue(externalResourcesItem7.Name) - externalResources15.RemoteID = types.StringPointerValue(externalResourcesItem7.RemoteID) - externalResources15.RemoteURL = types.StringPointerValue(externalResourcesItem7.RemoteURL) - if externalResourcesItem7.UpdatedAt != nil { - externalResources15.UpdatedAt = types.StringValue(externalResourcesItem7.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.UpdatedAt = types.StringNull() - } - if externalResourcesCount7+1 > len(ownedFunctionalities5.ExternalResources) { - ownedFunctionalities5.ExternalResources = append(ownedFunctionalities5.ExternalResources, externalResources15) - } else { - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionID = externalResources15.ConnectionID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionName = externalResources15.ConnectionName - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionType = externalResources15.ConnectionType - ownedFunctionalities5.ExternalResources[externalResourcesCount7].CreatedAt = externalResources15.CreatedAt - ownedFunctionalities5.ExternalResources[externalResourcesCount7].Name = externalResources15.Name - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteID = externalResources15.RemoteID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteURL = externalResources15.RemoteURL - ownedFunctionalities5.ExternalResources[externalResourcesCount7].UpdatedAt = externalResources15.UpdatedAt - } - } - ownedFunctionalities5.ID = types.StringPointerValue(ownedFunctionalitiesItem2.ID) - if len(ownedFunctionalitiesItem2.Labels) > 0 { - ownedFunctionalities5.Labels = make(map[string]types.String) - for key7, value9 := range ownedFunctionalitiesItem2.Labels { - ownedFunctionalities5.Labels[key7] = types.StringValue(value9) - } - } - ownedFunctionalities5.Links = []tfTypes.LinksEntity{} - for linksCount7, linksItem7 := range ownedFunctionalitiesItem2.Links { - var links15 tfTypes.LinksEntity - links15.HrefURL = types.StringPointerValue(linksItem7.HrefURL) - links15.IconURL = types.StringPointerValue(linksItem7.IconURL) - links15.ID = types.StringPointerValue(linksItem7.ID) - links15.Name = types.StringPointerValue(linksItem7.Name) - if linksCount7+1 > len(ownedFunctionalities5.Links) { - ownedFunctionalities5.Links = append(ownedFunctionalities5.Links, links15) - } else { - ownedFunctionalities5.Links[linksCount7].HrefURL = links15.HrefURL - ownedFunctionalities5.Links[linksCount7].IconURL = links15.IconURL - ownedFunctionalities5.Links[linksCount7].ID = links15.ID - ownedFunctionalities5.Links[linksCount7].Name = links15.Name - } - } - ownedFunctionalities5.Name = types.StringPointerValue(ownedFunctionalitiesItem2.Name) - if ownedFunctionalitiesItem2.Owner == nil { - ownedFunctionalities5.Owner = nil - } else { - ownedFunctionalities5.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities5.Slug = types.StringPointerValue(ownedFunctionalitiesItem2.Slug) - if ownedFunctionalitiesItem2.UpdatedAt != nil { - ownedFunctionalities5.UpdatedAt = types.StringValue(ownedFunctionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem2.UpdatedBy == nil { - ownedFunctionalities5.UpdatedBy = nil - } else { - ownedFunctionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities5.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Email) - ownedFunctionalities5.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.ID) - ownedFunctionalities5.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Name) - ownedFunctionalities5.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Source) - } - if ownedFunctionalitiesCount2+1 > len(teams1.OwnedFunctionalities) { - teams1.OwnedFunctionalities = append(teams1.OwnedFunctionalities, ownedFunctionalities5) - } else { - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ActiveIncidents = ownedFunctionalities5.ActiveIncidents - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AlertOnAdd = ownedFunctionalities5.AlertOnAdd - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AutoAddRespondingTeam = ownedFunctionalities5.AutoAddRespondingTeam - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].CreatedAt = ownedFunctionalities5.CreatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Description = ownedFunctionalities5.Description - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ExternalResources = ownedFunctionalities5.ExternalResources - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ID = ownedFunctionalities5.ID - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Labels = ownedFunctionalities5.Labels - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Links = ownedFunctionalities5.Links - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Name = ownedFunctionalities5.Name - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Owner = ownedFunctionalities5.Owner - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Slug = ownedFunctionalities5.Slug - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedAt = ownedFunctionalities5.UpdatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedBy = ownedFunctionalities5.UpdatedBy - } - } - teams1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount2, ownedRunbooksItem2 := range teamsItem.OwnedRunbooks { - var ownedRunbooks5 tfTypes.SlimRunbookEntity - if ownedRunbooksItem2.AttachmentRule == nil { - ownedRunbooks5.AttachmentRule = nil - } else { - ownedRunbooks5.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem2.AttachmentRule.Logic == nil { - ownedRunbooks5.AttachmentRule.Logic = nil - } else { - ownedRunbooks5.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem2.AttachmentRule.UserData == nil { - ownedRunbooks5.AttachmentRule.UserData = nil - } else { - ownedRunbooks5.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks5.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Label) - ownedRunbooks5.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Type) - ownedRunbooks5.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Value) - } - } - ownedRunbooks5.Categories = types.StringPointerValue(ownedRunbooksItem2.Categories) - if ownedRunbooksItem2.CreatedAt != nil { - ownedRunbooks5.CreatedAt = types.StringValue(ownedRunbooksItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.CreatedAt = types.StringNull() - } - ownedRunbooks5.Description = types.StringPointerValue(ownedRunbooksItem2.Description) - ownedRunbooks5.ID = types.StringPointerValue(ownedRunbooksItem2.ID) - ownedRunbooks5.Name = types.StringPointerValue(ownedRunbooksItem2.Name) - if ownedRunbooksItem2.Owner == nil { - ownedRunbooks5.Owner = nil - } else { - ownedRunbooks5.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks5.Summary = types.StringPointerValue(ownedRunbooksItem2.Summary) - ownedRunbooks5.Type = types.StringPointerValue(ownedRunbooksItem2.Type) - if ownedRunbooksItem2.UpdatedAt != nil { - ownedRunbooks5.UpdatedAt = types.StringValue(ownedRunbooksItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount2+1 > len(teams1.OwnedRunbooks) { - teams1.OwnedRunbooks = append(teams1.OwnedRunbooks, ownedRunbooks5) - } else { - teams1.OwnedRunbooks[ownedRunbooksCount2].AttachmentRule = ownedRunbooks5.AttachmentRule - teams1.OwnedRunbooks[ownedRunbooksCount2].Categories = ownedRunbooks5.Categories - teams1.OwnedRunbooks[ownedRunbooksCount2].CreatedAt = ownedRunbooks5.CreatedAt - teams1.OwnedRunbooks[ownedRunbooksCount2].Description = ownedRunbooks5.Description - teams1.OwnedRunbooks[ownedRunbooksCount2].ID = ownedRunbooks5.ID - teams1.OwnedRunbooks[ownedRunbooksCount2].Name = ownedRunbooks5.Name - teams1.OwnedRunbooks[ownedRunbooksCount2].Owner = ownedRunbooks5.Owner - teams1.OwnedRunbooks[ownedRunbooksCount2].Summary = ownedRunbooks5.Summary - teams1.OwnedRunbooks[ownedRunbooksCount2].Type = ownedRunbooks5.Type - teams1.OwnedRunbooks[ownedRunbooksCount2].UpdatedAt = ownedRunbooks5.UpdatedAt - } - } - teams1.SignalsIcalURL = types.StringPointerValue(teamsItem.SignalsIcalURL) - if teamsItem.SlackChannel == nil { - teams1.SlackChannel = nil - } else { - teams1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams1.SlackChannel.ID = types.StringPointerValue(teamsItem.SlackChannel.ID) - teams1.SlackChannel.Name = types.StringPointerValue(teamsItem.SlackChannel.Name) - teams1.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem.SlackChannel.SlackChannelID) - } - teams1.Slug = types.StringPointerValue(teamsItem.Slug) - if teamsItem.UpdatedAt != nil { - teams1.UpdatedAt = types.StringValue(teamsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams1.UpdatedAt = types.StringNull() - } - if teamsCount+1 > len(r.ConnectedService.Teams) { - r.ConnectedService.Teams = append(r.ConnectedService.Teams, teams1) - } else { - r.ConnectedService.Teams[teamsCount].CreatedAt = teams1.CreatedAt - r.ConnectedService.Teams[teamsCount].CreatedBy = teams1.CreatedBy - r.ConnectedService.Teams[teamsCount].Description = teams1.Description - r.ConnectedService.Teams[teamsCount].Functionalities = teams1.Functionalities - r.ConnectedService.Teams[teamsCount].ID = teams1.ID - r.ConnectedService.Teams[teamsCount].Memberships = teams1.Memberships - r.ConnectedService.Teams[teamsCount].MsTeamsChannel = teams1.MsTeamsChannel - r.ConnectedService.Teams[teamsCount].Name = teams1.Name - r.ConnectedService.Teams[teamsCount].OwnedFunctionalities = teams1.OwnedFunctionalities - r.ConnectedService.Teams[teamsCount].OwnedRunbooks = teams1.OwnedRunbooks - r.ConnectedService.Teams[teamsCount].SignalsIcalURL = teams1.SignalsIcalURL - r.ConnectedService.Teams[teamsCount].SlackChannel = teams1.SlackChannel - r.ConnectedService.Teams[teamsCount].Slug = teams1.Slug - r.ConnectedService.Teams[teamsCount].UpdatedAt = teams1.UpdatedAt - } - } - if resp.ConnectedService.UpdatedAt != nil { - r.ConnectedService.UpdatedAt = types.StringValue(resp.ConnectedService.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.UpdatedAt = types.StringNull() - } - if resp.ConnectedService.UpdatedBy == nil { - r.ConnectedService.UpdatedBy = nil - } else { - r.ConnectedService.UpdatedBy = &tfTypes.AuthorEntity{} - r.ConnectedService.UpdatedBy.Email = types.StringPointerValue(resp.ConnectedService.UpdatedBy.Email) - r.ConnectedService.UpdatedBy.ID = types.StringPointerValue(resp.ConnectedService.UpdatedBy.ID) - r.ConnectedService.UpdatedBy.Name = types.StringPointerValue(resp.ConnectedService.UpdatedBy.Name) - r.ConnectedService.UpdatedBy.Source = types.StringPointerValue(resp.ConnectedService.UpdatedBy.Source) - } - } - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.ID = types.StringPointerValue(resp.ID) - r.Notes = types.StringPointerValue(resp.Notes) - if resp.Service == nil { - r.Service = nil - } else { - r.Service = &tfTypes.ServiceEntity{} - r.Service.ActiveIncidents = []types.String{} - for _, v := range resp.Service.ActiveIncidents { - r.Service.ActiveIncidents = append(r.Service.ActiveIncidents, types.StringValue(v)) - } - r.Service.AlertOnAdd = types.BoolPointerValue(resp.Service.AlertOnAdd) - r.Service.AllowedParams = []types.String{} - for _, v := range resp.Service.AllowedParams { - r.Service.AllowedParams = append(r.Service.AllowedParams, types.StringValue(v)) - } - r.Service.AutoAddRespondingTeam = types.BoolPointerValue(resp.Service.AutoAddRespondingTeam) - r.Service.Checklists = []tfTypes.Checklists{} - if len(r.Service.Checklists) > len(resp.Service.Checklists) { - r.Service.Checklists = r.Service.Checklists[:len(resp.Service.Checklists)] - } - for checklistsCount1, checklistsItem1 := range resp.Service.Checklists { - var checklists3 tfTypes.Checklists - checklists3.Checks = []tfTypes.ChecklistCheckEntity{} - for checksCount1, checksItem1 := range checklistsItem1.Checks { - var checks3 tfTypes.ChecklistCheckEntity - checks3.Description = types.StringPointerValue(checksItem1.Description) - checks3.ID = types.StringPointerValue(checksItem1.ID) - checks3.Name = types.StringPointerValue(checksItem1.Name) - checks3.Status = types.BoolPointerValue(checksItem1.Status) - if checksCount1+1 > len(checklists3.Checks) { - checklists3.Checks = append(checklists3.Checks, checks3) - } else { - checklists3.Checks[checksCount1].Description = checks3.Description - checklists3.Checks[checksCount1].ID = checks3.ID - checklists3.Checks[checksCount1].Name = checks3.Name - checklists3.Checks[checksCount1].Status = checks3.Status - } - } - checklists3.CreatedAt = types.StringPointerValue(checklistsItem1.CreatedAt) - checklists3.Description = types.StringPointerValue(checklistsItem1.Description) - checklists3.ID = types.StringPointerValue(checklistsItem1.ID) - checklists3.Name = types.StringPointerValue(checklistsItem1.Name) - if checklistsItem1.Owner == nil { - checklists3.Owner = nil - } else { - checklists3.Owner = &tfTypes.TeamEntity{} - if checklistsItem1.Owner.CreatedAt != nil { - checklists3.Owner.CreatedAt = types.StringValue(checklistsItem1.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - checklists3.Owner.CreatedAt = types.StringNull() - } - if checklistsItem1.Owner.CreatedBy == nil { - checklists3.Owner.CreatedBy = nil - } else { - checklists3.Owner.CreatedBy = &tfTypes.AuthorEntity{} - checklists3.Owner.CreatedBy.Email = types.StringPointerValue(checklistsItem1.Owner.CreatedBy.Email) - checklists3.Owner.CreatedBy.ID = types.StringPointerValue(checklistsItem1.Owner.CreatedBy.ID) - checklists3.Owner.CreatedBy.Name = types.StringPointerValue(checklistsItem1.Owner.CreatedBy.Name) - checklists3.Owner.CreatedBy.Source = types.StringPointerValue(checklistsItem1.Owner.CreatedBy.Source) - } - checklists3.Owner.Description = types.StringPointerValue(checklistsItem1.Owner.Description) - checklists3.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount4, functionalitiesItem4 := range checklistsItem1.Owner.Functionalities { - var functionalities9 tfTypes.FunctionalityEntity - functionalities9.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem4.ActiveIncidents { - functionalities9.ActiveIncidents = append(functionalities9.ActiveIncidents, types.StringValue(v)) - } - functionalities9.AlertOnAdd = types.BoolPointerValue(functionalitiesItem4.AlertOnAdd) - functionalities9.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem4.AutoAddRespondingTeam) - if functionalitiesItem4.CreatedAt != nil { - functionalities9.CreatedAt = types.StringValue(functionalitiesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities9.CreatedAt = types.StringNull() - } - functionalities9.Description = types.StringPointerValue(functionalitiesItem4.Description) - functionalities9.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount8, externalResourcesItem8 := range functionalitiesItem4.ExternalResources { - var externalResources17 tfTypes.ExternalResourceEntity - externalResources17.ConnectionID = types.StringPointerValue(externalResourcesItem8.ConnectionID) - externalResources17.ConnectionName = types.StringPointerValue(externalResourcesItem8.ConnectionName) - externalResources17.ConnectionType = types.StringPointerValue(externalResourcesItem8.ConnectionType) - if externalResourcesItem8.CreatedAt != nil { - externalResources17.CreatedAt = types.StringValue(externalResourcesItem8.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources17.CreatedAt = types.StringNull() - } - externalResources17.Name = types.StringPointerValue(externalResourcesItem8.Name) - externalResources17.RemoteID = types.StringPointerValue(externalResourcesItem8.RemoteID) - externalResources17.RemoteURL = types.StringPointerValue(externalResourcesItem8.RemoteURL) - if externalResourcesItem8.UpdatedAt != nil { - externalResources17.UpdatedAt = types.StringValue(externalResourcesItem8.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources17.UpdatedAt = types.StringNull() - } - if externalResourcesCount8+1 > len(functionalities9.ExternalResources) { - functionalities9.ExternalResources = append(functionalities9.ExternalResources, externalResources17) - } else { - functionalities9.ExternalResources[externalResourcesCount8].ConnectionID = externalResources17.ConnectionID - functionalities9.ExternalResources[externalResourcesCount8].ConnectionName = externalResources17.ConnectionName - functionalities9.ExternalResources[externalResourcesCount8].ConnectionType = externalResources17.ConnectionType - functionalities9.ExternalResources[externalResourcesCount8].CreatedAt = externalResources17.CreatedAt - functionalities9.ExternalResources[externalResourcesCount8].Name = externalResources17.Name - functionalities9.ExternalResources[externalResourcesCount8].RemoteID = externalResources17.RemoteID - functionalities9.ExternalResources[externalResourcesCount8].RemoteURL = externalResources17.RemoteURL - functionalities9.ExternalResources[externalResourcesCount8].UpdatedAt = externalResources17.UpdatedAt - } - } - functionalities9.ID = types.StringPointerValue(functionalitiesItem4.ID) - if len(functionalitiesItem4.Labels) > 0 { - functionalities9.Labels = make(map[string]types.String) - for key8, value11 := range functionalitiesItem4.Labels { - functionalities9.Labels[key8] = types.StringValue(value11) - } - } - functionalities9.Links = []tfTypes.LinksEntity{} - for linksCount8, linksItem8 := range functionalitiesItem4.Links { - var links17 tfTypes.LinksEntity - links17.HrefURL = types.StringPointerValue(linksItem8.HrefURL) - links17.IconURL = types.StringPointerValue(linksItem8.IconURL) - links17.ID = types.StringPointerValue(linksItem8.ID) - links17.Name = types.StringPointerValue(linksItem8.Name) - if linksCount8+1 > len(functionalities9.Links) { - functionalities9.Links = append(functionalities9.Links, links17) - } else { - functionalities9.Links[linksCount8].HrefURL = links17.HrefURL - functionalities9.Links[linksCount8].IconURL = links17.IconURL - functionalities9.Links[linksCount8].ID = links17.ID - functionalities9.Links[linksCount8].Name = links17.Name - } - } - functionalities9.Name = types.StringPointerValue(functionalitiesItem4.Name) - if functionalitiesItem4.Owner == nil { - functionalities9.Owner = nil - } else { - functionalities9.Owner = &tfTypes.TeamEntity1{} - } - functionalities9.Slug = types.StringPointerValue(functionalitiesItem4.Slug) - if functionalitiesItem4.UpdatedAt != nil { - functionalities9.UpdatedAt = types.StringValue(functionalitiesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities9.UpdatedAt = types.StringNull() - } - if functionalitiesItem4.UpdatedBy == nil { - functionalities9.UpdatedBy = nil - } else { - functionalities9.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities9.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem4.UpdatedBy.Email) - functionalities9.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem4.UpdatedBy.ID) - functionalities9.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem4.UpdatedBy.Name) - functionalities9.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem4.UpdatedBy.Source) - } - if functionalitiesCount4+1 > len(checklists3.Owner.Functionalities) { - checklists3.Owner.Functionalities = append(checklists3.Owner.Functionalities, functionalities9) - } else { - checklists3.Owner.Functionalities[functionalitiesCount4].ActiveIncidents = functionalities9.ActiveIncidents - checklists3.Owner.Functionalities[functionalitiesCount4].AlertOnAdd = functionalities9.AlertOnAdd - checklists3.Owner.Functionalities[functionalitiesCount4].AutoAddRespondingTeam = functionalities9.AutoAddRespondingTeam - checklists3.Owner.Functionalities[functionalitiesCount4].CreatedAt = functionalities9.CreatedAt - checklists3.Owner.Functionalities[functionalitiesCount4].Description = functionalities9.Description - checklists3.Owner.Functionalities[functionalitiesCount4].ExternalResources = functionalities9.ExternalResources - checklists3.Owner.Functionalities[functionalitiesCount4].ID = functionalities9.ID - checklists3.Owner.Functionalities[functionalitiesCount4].Labels = functionalities9.Labels - checklists3.Owner.Functionalities[functionalitiesCount4].Links = functionalities9.Links - checklists3.Owner.Functionalities[functionalitiesCount4].Name = functionalities9.Name - checklists3.Owner.Functionalities[functionalitiesCount4].Owner = functionalities9.Owner - checklists3.Owner.Functionalities[functionalitiesCount4].Slug = functionalities9.Slug - checklists3.Owner.Functionalities[functionalitiesCount4].UpdatedAt = functionalities9.UpdatedAt - checklists3.Owner.Functionalities[functionalitiesCount4].UpdatedBy = functionalities9.UpdatedBy - } - } - checklists3.Owner.ID = types.StringPointerValue(checklistsItem1.Owner.ID) - checklists3.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount3, membershipsItem3 := range checklistsItem1.Owner.Memberships { - var memberships7 tfTypes.MembershipEntity - if membershipsItem3.DefaultIncidentRole == nil { - memberships7.DefaultIncidentRole = nil - } else { - memberships7.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem3.DefaultIncidentRole.CreatedAt != nil { - memberships7.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem3.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships7.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships7.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem3.DefaultIncidentRole.Description) - if membershipsItem3.DefaultIncidentRole.DiscardedAt != nil { - memberships7.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem3.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships7.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships7.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem3.DefaultIncidentRole.ID) - memberships7.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem3.DefaultIncidentRole.Name) - memberships7.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem3.DefaultIncidentRole.Summary) - if membershipsItem3.DefaultIncidentRole.UpdatedAt != nil { - memberships7.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem3.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships7.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem3.Schedule == nil { - memberships7.Schedule = nil - } else { - memberships7.Schedule = &tfTypes.ScheduleEntity{} - memberships7.Schedule.Discarded = types.BoolPointerValue(membershipsItem3.Schedule.Discarded) - memberships7.Schedule.ID = types.StringPointerValue(membershipsItem3.Schedule.ID) - memberships7.Schedule.Integration = types.StringPointerValue(membershipsItem3.Schedule.Integration) - memberships7.Schedule.Name = types.StringPointerValue(membershipsItem3.Schedule.Name) - } - if membershipsItem3.User == nil { - memberships7.User = nil - } else { - memberships7.User = &tfTypes.UserEntity{} - if membershipsItem3.User.CreatedAt != nil { - memberships7.User.CreatedAt = types.StringValue(membershipsItem3.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships7.User.CreatedAt = types.StringNull() - } - memberships7.User.Email = types.StringPointerValue(membershipsItem3.User.Email) - memberships7.User.ID = types.StringPointerValue(membershipsItem3.User.ID) - memberships7.User.Name = types.StringPointerValue(membershipsItem3.User.Name) - memberships7.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem3.User.SignalsEnabledNotificationTypes { - memberships7.User.SignalsEnabledNotificationTypes = append(memberships7.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships7.User.SlackLinked = types.BoolPointerValue(membershipsItem3.User.SlackLinked) - memberships7.User.SlackUserID = types.StringPointerValue(membershipsItem3.User.SlackUserID) - if membershipsItem3.User.UpdatedAt != nil { - memberships7.User.UpdatedAt = types.StringValue(membershipsItem3.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships7.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount3+1 > len(checklists3.Owner.Memberships) { - checklists3.Owner.Memberships = append(checklists3.Owner.Memberships, memberships7) - } else { - checklists3.Owner.Memberships[membershipsCount3].DefaultIncidentRole = memberships7.DefaultIncidentRole - checklists3.Owner.Memberships[membershipsCount3].Schedule = memberships7.Schedule - checklists3.Owner.Memberships[membershipsCount3].User = memberships7.User - } - } - if checklistsItem1.Owner.MsTeamsChannel == nil { - checklists3.Owner.MsTeamsChannel = nil - } else { - checklists3.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - checklists3.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.ChannelID) - checklists3.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.ChannelName) - checklists3.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.ChannelURL) - checklists3.Owner.MsTeamsChannel.ID = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.ID) - checklists3.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.MsTeamID) - checklists3.Owner.MsTeamsChannel.Status = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.Status) - checklists3.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.TeamName) - } - checklists3.Owner.Name = types.StringPointerValue(checklistsItem1.Owner.Name) - checklists3.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount3, ownedFunctionalitiesItem3 := range checklistsItem1.Owner.OwnedFunctionalities { - var ownedFunctionalities7 tfTypes.FunctionalityEntity - ownedFunctionalities7.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem3.ActiveIncidents { - ownedFunctionalities7.ActiveIncidents = append(ownedFunctionalities7.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities7.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem3.AlertOnAdd) - ownedFunctionalities7.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem3.AutoAddRespondingTeam) - if ownedFunctionalitiesItem3.CreatedAt != nil { - ownedFunctionalities7.CreatedAt = types.StringValue(ownedFunctionalitiesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities7.CreatedAt = types.StringNull() - } - ownedFunctionalities7.Description = types.StringPointerValue(ownedFunctionalitiesItem3.Description) - ownedFunctionalities7.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount9, externalResourcesItem9 := range ownedFunctionalitiesItem3.ExternalResources { - var externalResources19 tfTypes.ExternalResourceEntity - externalResources19.ConnectionID = types.StringPointerValue(externalResourcesItem9.ConnectionID) - externalResources19.ConnectionName = types.StringPointerValue(externalResourcesItem9.ConnectionName) - externalResources19.ConnectionType = types.StringPointerValue(externalResourcesItem9.ConnectionType) - if externalResourcesItem9.CreatedAt != nil { - externalResources19.CreatedAt = types.StringValue(externalResourcesItem9.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources19.CreatedAt = types.StringNull() - } - externalResources19.Name = types.StringPointerValue(externalResourcesItem9.Name) - externalResources19.RemoteID = types.StringPointerValue(externalResourcesItem9.RemoteID) - externalResources19.RemoteURL = types.StringPointerValue(externalResourcesItem9.RemoteURL) - if externalResourcesItem9.UpdatedAt != nil { - externalResources19.UpdatedAt = types.StringValue(externalResourcesItem9.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources19.UpdatedAt = types.StringNull() - } - if externalResourcesCount9+1 > len(ownedFunctionalities7.ExternalResources) { - ownedFunctionalities7.ExternalResources = append(ownedFunctionalities7.ExternalResources, externalResources19) - } else { - ownedFunctionalities7.ExternalResources[externalResourcesCount9].ConnectionID = externalResources19.ConnectionID - ownedFunctionalities7.ExternalResources[externalResourcesCount9].ConnectionName = externalResources19.ConnectionName - ownedFunctionalities7.ExternalResources[externalResourcesCount9].ConnectionType = externalResources19.ConnectionType - ownedFunctionalities7.ExternalResources[externalResourcesCount9].CreatedAt = externalResources19.CreatedAt - ownedFunctionalities7.ExternalResources[externalResourcesCount9].Name = externalResources19.Name - ownedFunctionalities7.ExternalResources[externalResourcesCount9].RemoteID = externalResources19.RemoteID - ownedFunctionalities7.ExternalResources[externalResourcesCount9].RemoteURL = externalResources19.RemoteURL - ownedFunctionalities7.ExternalResources[externalResourcesCount9].UpdatedAt = externalResources19.UpdatedAt - } - } - ownedFunctionalities7.ID = types.StringPointerValue(ownedFunctionalitiesItem3.ID) - if len(ownedFunctionalitiesItem3.Labels) > 0 { - ownedFunctionalities7.Labels = make(map[string]types.String) - for key9, value12 := range ownedFunctionalitiesItem3.Labels { - ownedFunctionalities7.Labels[key9] = types.StringValue(value12) - } - } - ownedFunctionalities7.Links = []tfTypes.LinksEntity{} - for linksCount9, linksItem9 := range ownedFunctionalitiesItem3.Links { - var links19 tfTypes.LinksEntity - links19.HrefURL = types.StringPointerValue(linksItem9.HrefURL) - links19.IconURL = types.StringPointerValue(linksItem9.IconURL) - links19.ID = types.StringPointerValue(linksItem9.ID) - links19.Name = types.StringPointerValue(linksItem9.Name) - if linksCount9+1 > len(ownedFunctionalities7.Links) { - ownedFunctionalities7.Links = append(ownedFunctionalities7.Links, links19) - } else { - ownedFunctionalities7.Links[linksCount9].HrefURL = links19.HrefURL - ownedFunctionalities7.Links[linksCount9].IconURL = links19.IconURL - ownedFunctionalities7.Links[linksCount9].ID = links19.ID - ownedFunctionalities7.Links[linksCount9].Name = links19.Name - } - } - ownedFunctionalities7.Name = types.StringPointerValue(ownedFunctionalitiesItem3.Name) - if ownedFunctionalitiesItem3.Owner == nil { - ownedFunctionalities7.Owner = nil - } else { - ownedFunctionalities7.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities7.Slug = types.StringPointerValue(ownedFunctionalitiesItem3.Slug) - if ownedFunctionalitiesItem3.UpdatedAt != nil { - ownedFunctionalities7.UpdatedAt = types.StringValue(ownedFunctionalitiesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities7.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem3.UpdatedBy == nil { - ownedFunctionalities7.UpdatedBy = nil - } else { - ownedFunctionalities7.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities7.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem3.UpdatedBy.Email) - ownedFunctionalities7.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem3.UpdatedBy.ID) - ownedFunctionalities7.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem3.UpdatedBy.Name) - ownedFunctionalities7.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem3.UpdatedBy.Source) - } - if ownedFunctionalitiesCount3+1 > len(checklists3.Owner.OwnedFunctionalities) { - checklists3.Owner.OwnedFunctionalities = append(checklists3.Owner.OwnedFunctionalities, ownedFunctionalities7) - } else { - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].ActiveIncidents = ownedFunctionalities7.ActiveIncidents - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].AlertOnAdd = ownedFunctionalities7.AlertOnAdd - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].AutoAddRespondingTeam = ownedFunctionalities7.AutoAddRespondingTeam - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].CreatedAt = ownedFunctionalities7.CreatedAt - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Description = ownedFunctionalities7.Description - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].ExternalResources = ownedFunctionalities7.ExternalResources - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].ID = ownedFunctionalities7.ID - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Labels = ownedFunctionalities7.Labels - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Links = ownedFunctionalities7.Links - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Name = ownedFunctionalities7.Name - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Owner = ownedFunctionalities7.Owner - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Slug = ownedFunctionalities7.Slug - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].UpdatedAt = ownedFunctionalities7.UpdatedAt - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].UpdatedBy = ownedFunctionalities7.UpdatedBy - } - } - checklists3.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount3, ownedRunbooksItem3 := range checklistsItem1.Owner.OwnedRunbooks { - var ownedRunbooks7 tfTypes.SlimRunbookEntity - if ownedRunbooksItem3.AttachmentRule == nil { - ownedRunbooks7.AttachmentRule = nil - } else { - ownedRunbooks7.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem3.AttachmentRule.Logic == nil { - ownedRunbooks7.AttachmentRule.Logic = nil - } else { - ownedRunbooks7.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem3.AttachmentRule.UserData == nil { - ownedRunbooks7.AttachmentRule.UserData = nil - } else { - ownedRunbooks7.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks7.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem3.AttachmentRule.UserData.Label) - ownedRunbooks7.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem3.AttachmentRule.UserData.Type) - ownedRunbooks7.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem3.AttachmentRule.UserData.Value) - } - } - ownedRunbooks7.Categories = types.StringPointerValue(ownedRunbooksItem3.Categories) - if ownedRunbooksItem3.CreatedAt != nil { - ownedRunbooks7.CreatedAt = types.StringValue(ownedRunbooksItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks7.CreatedAt = types.StringNull() - } - ownedRunbooks7.Description = types.StringPointerValue(ownedRunbooksItem3.Description) - ownedRunbooks7.ID = types.StringPointerValue(ownedRunbooksItem3.ID) - ownedRunbooks7.Name = types.StringPointerValue(ownedRunbooksItem3.Name) - if ownedRunbooksItem3.Owner == nil { - ownedRunbooks7.Owner = nil - } else { - ownedRunbooks7.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks7.Summary = types.StringPointerValue(ownedRunbooksItem3.Summary) - ownedRunbooks7.Type = types.StringPointerValue(ownedRunbooksItem3.Type) - if ownedRunbooksItem3.UpdatedAt != nil { - ownedRunbooks7.UpdatedAt = types.StringValue(ownedRunbooksItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks7.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount3+1 > len(checklists3.Owner.OwnedRunbooks) { - checklists3.Owner.OwnedRunbooks = append(checklists3.Owner.OwnedRunbooks, ownedRunbooks7) - } else { - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].AttachmentRule = ownedRunbooks7.AttachmentRule - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Categories = ownedRunbooks7.Categories - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].CreatedAt = ownedRunbooks7.CreatedAt - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Description = ownedRunbooks7.Description - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].ID = ownedRunbooks7.ID - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Name = ownedRunbooks7.Name - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Owner = ownedRunbooks7.Owner - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Summary = ownedRunbooks7.Summary - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Type = ownedRunbooks7.Type - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].UpdatedAt = ownedRunbooks7.UpdatedAt - } - } - checklists3.Owner.SignalsIcalURL = types.StringPointerValue(checklistsItem1.Owner.SignalsIcalURL) - if checklistsItem1.Owner.SlackChannel == nil { - checklists3.Owner.SlackChannel = nil - } else { - checklists3.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - checklists3.Owner.SlackChannel.ID = types.StringPointerValue(checklistsItem1.Owner.SlackChannel.ID) - checklists3.Owner.SlackChannel.Name = types.StringPointerValue(checklistsItem1.Owner.SlackChannel.Name) - checklists3.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(checklistsItem1.Owner.SlackChannel.SlackChannelID) - } - checklists3.Owner.Slug = types.StringPointerValue(checklistsItem1.Owner.Slug) - if checklistsItem1.Owner.UpdatedAt != nil { - checklists3.Owner.UpdatedAt = types.StringValue(checklistsItem1.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists3.Owner.UpdatedAt = types.StringNull() - } - } - if checklistsItem1.UpdatedAt != nil { - checklists3.UpdatedAt = types.StringValue(checklistsItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists3.UpdatedAt = types.StringNull() - } - if checklistsCount1+1 > len(r.Service.Checklists) { - r.Service.Checklists = append(r.Service.Checklists, checklists3) - } else { - r.Service.Checklists[checklistsCount1].Checks = checklists3.Checks - r.Service.Checklists[checklistsCount1].CreatedAt = checklists3.CreatedAt - r.Service.Checklists[checklistsCount1].Description = checklists3.Description - r.Service.Checklists[checklistsCount1].ID = checklists3.ID - r.Service.Checklists[checklistsCount1].Name = checklists3.Name - r.Service.Checklists[checklistsCount1].Owner = checklists3.Owner - r.Service.Checklists[checklistsCount1].UpdatedAt = checklists3.UpdatedAt - } - } - if resp.Service.CompletedChecks != nil { - r.Service.CompletedChecks = types.Int64Value(int64(*resp.Service.CompletedChecks)) - } else { - r.Service.CompletedChecks = types.Int64Null() - } - if resp.Service.CreatedAt != nil { - r.Service.CreatedAt = types.StringValue(resp.Service.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.CreatedAt = types.StringNull() - } - r.Service.Description = types.StringPointerValue(resp.Service.Description) - r.Service.ExternalResources = []tfTypes.ExternalResourceEntity{} - if len(r.Service.ExternalResources) > len(resp.Service.ExternalResources) { - r.Service.ExternalResources = r.Service.ExternalResources[:len(resp.Service.ExternalResources)] - } - for externalResourcesCount10, externalResourcesItem10 := range resp.Service.ExternalResources { - var externalResources21 tfTypes.ExternalResourceEntity - externalResources21.ConnectionID = types.StringPointerValue(externalResourcesItem10.ConnectionID) - externalResources21.ConnectionName = types.StringPointerValue(externalResourcesItem10.ConnectionName) - externalResources21.ConnectionType = types.StringPointerValue(externalResourcesItem10.ConnectionType) - if externalResourcesItem10.CreatedAt != nil { - externalResources21.CreatedAt = types.StringValue(externalResourcesItem10.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources21.CreatedAt = types.StringNull() - } - externalResources21.Name = types.StringPointerValue(externalResourcesItem10.Name) - externalResources21.RemoteID = types.StringPointerValue(externalResourcesItem10.RemoteID) - externalResources21.RemoteURL = types.StringPointerValue(externalResourcesItem10.RemoteURL) - if externalResourcesItem10.UpdatedAt != nil { - externalResources21.UpdatedAt = types.StringValue(externalResourcesItem10.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources21.UpdatedAt = types.StringNull() - } - if externalResourcesCount10+1 > len(r.Service.ExternalResources) { - r.Service.ExternalResources = append(r.Service.ExternalResources, externalResources21) - } else { - r.Service.ExternalResources[externalResourcesCount10].ConnectionID = externalResources21.ConnectionID - r.Service.ExternalResources[externalResourcesCount10].ConnectionName = externalResources21.ConnectionName - r.Service.ExternalResources[externalResourcesCount10].ConnectionType = externalResources21.ConnectionType - r.Service.ExternalResources[externalResourcesCount10].CreatedAt = externalResources21.CreatedAt - r.Service.ExternalResources[externalResourcesCount10].Name = externalResources21.Name - r.Service.ExternalResources[externalResourcesCount10].RemoteID = externalResources21.RemoteID - r.Service.ExternalResources[externalResourcesCount10].RemoteURL = externalResources21.RemoteURL - r.Service.ExternalResources[externalResourcesCount10].UpdatedAt = externalResources21.UpdatedAt - } - } - r.Service.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Service.Functionalities) > len(resp.Service.Functionalities) { - r.Service.Functionalities = r.Service.Functionalities[:len(resp.Service.Functionalities)] - } - for functionalitiesCount5, functionalitiesItem5 := range resp.Service.Functionalities { - var functionalities11 tfTypes.FunctionalityEntity - functionalities11.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem5.ActiveIncidents { - functionalities11.ActiveIncidents = append(functionalities11.ActiveIncidents, types.StringValue(v)) - } - functionalities11.AlertOnAdd = types.BoolPointerValue(functionalitiesItem5.AlertOnAdd) - functionalities11.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem5.AutoAddRespondingTeam) - if functionalitiesItem5.CreatedAt != nil { - functionalities11.CreatedAt = types.StringValue(functionalitiesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities11.CreatedAt = types.StringNull() - } - functionalities11.Description = types.StringPointerValue(functionalitiesItem5.Description) - functionalities11.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount11, externalResourcesItem11 := range functionalitiesItem5.ExternalResources { - var externalResources23 tfTypes.ExternalResourceEntity - externalResources23.ConnectionID = types.StringPointerValue(externalResourcesItem11.ConnectionID) - externalResources23.ConnectionName = types.StringPointerValue(externalResourcesItem11.ConnectionName) - externalResources23.ConnectionType = types.StringPointerValue(externalResourcesItem11.ConnectionType) - if externalResourcesItem11.CreatedAt != nil { - externalResources23.CreatedAt = types.StringValue(externalResourcesItem11.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources23.CreatedAt = types.StringNull() - } - externalResources23.Name = types.StringPointerValue(externalResourcesItem11.Name) - externalResources23.RemoteID = types.StringPointerValue(externalResourcesItem11.RemoteID) - externalResources23.RemoteURL = types.StringPointerValue(externalResourcesItem11.RemoteURL) - if externalResourcesItem11.UpdatedAt != nil { - externalResources23.UpdatedAt = types.StringValue(externalResourcesItem11.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources23.UpdatedAt = types.StringNull() - } - if externalResourcesCount11+1 > len(functionalities11.ExternalResources) { - functionalities11.ExternalResources = append(functionalities11.ExternalResources, externalResources23) - } else { - functionalities11.ExternalResources[externalResourcesCount11].ConnectionID = externalResources23.ConnectionID - functionalities11.ExternalResources[externalResourcesCount11].ConnectionName = externalResources23.ConnectionName - functionalities11.ExternalResources[externalResourcesCount11].ConnectionType = externalResources23.ConnectionType - functionalities11.ExternalResources[externalResourcesCount11].CreatedAt = externalResources23.CreatedAt - functionalities11.ExternalResources[externalResourcesCount11].Name = externalResources23.Name - functionalities11.ExternalResources[externalResourcesCount11].RemoteID = externalResources23.RemoteID - functionalities11.ExternalResources[externalResourcesCount11].RemoteURL = externalResources23.RemoteURL - functionalities11.ExternalResources[externalResourcesCount11].UpdatedAt = externalResources23.UpdatedAt - } - } - functionalities11.ID = types.StringPointerValue(functionalitiesItem5.ID) - if len(functionalitiesItem5.Labels) > 0 { - functionalities11.Labels = make(map[string]types.String) - for key10, value14 := range functionalitiesItem5.Labels { - functionalities11.Labels[key10] = types.StringValue(value14) - } - } - functionalities11.Links = []tfTypes.LinksEntity{} - for linksCount10, linksItem10 := range functionalitiesItem5.Links { - var links21 tfTypes.LinksEntity - links21.HrefURL = types.StringPointerValue(linksItem10.HrefURL) - links21.IconURL = types.StringPointerValue(linksItem10.IconURL) - links21.ID = types.StringPointerValue(linksItem10.ID) - links21.Name = types.StringPointerValue(linksItem10.Name) - if linksCount10+1 > len(functionalities11.Links) { - functionalities11.Links = append(functionalities11.Links, links21) - } else { - functionalities11.Links[linksCount10].HrefURL = links21.HrefURL - functionalities11.Links[linksCount10].IconURL = links21.IconURL - functionalities11.Links[linksCount10].ID = links21.ID - functionalities11.Links[linksCount10].Name = links21.Name - } - } - functionalities11.Name = types.StringPointerValue(functionalitiesItem5.Name) - if functionalitiesItem5.Owner == nil { - functionalities11.Owner = nil - } else { - functionalities11.Owner = &tfTypes.TeamEntity1{} - } - functionalities11.Slug = types.StringPointerValue(functionalitiesItem5.Slug) - if functionalitiesItem5.UpdatedAt != nil { - functionalities11.UpdatedAt = types.StringValue(functionalitiesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities11.UpdatedAt = types.StringNull() - } - if functionalitiesItem5.UpdatedBy == nil { - functionalities11.UpdatedBy = nil - } else { - functionalities11.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities11.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem5.UpdatedBy.Email) - functionalities11.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem5.UpdatedBy.ID) - functionalities11.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem5.UpdatedBy.Name) - functionalities11.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem5.UpdatedBy.Source) - } - if functionalitiesCount5+1 > len(r.Service.Functionalities) { - r.Service.Functionalities = append(r.Service.Functionalities, functionalities11) - } else { - r.Service.Functionalities[functionalitiesCount5].ActiveIncidents = functionalities11.ActiveIncidents - r.Service.Functionalities[functionalitiesCount5].AlertOnAdd = functionalities11.AlertOnAdd - r.Service.Functionalities[functionalitiesCount5].AutoAddRespondingTeam = functionalities11.AutoAddRespondingTeam - r.Service.Functionalities[functionalitiesCount5].CreatedAt = functionalities11.CreatedAt - r.Service.Functionalities[functionalitiesCount5].Description = functionalities11.Description - r.Service.Functionalities[functionalitiesCount5].ExternalResources = functionalities11.ExternalResources - r.Service.Functionalities[functionalitiesCount5].ID = functionalities11.ID - r.Service.Functionalities[functionalitiesCount5].Labels = functionalities11.Labels - r.Service.Functionalities[functionalitiesCount5].Links = functionalities11.Links - r.Service.Functionalities[functionalitiesCount5].Name = functionalities11.Name - r.Service.Functionalities[functionalitiesCount5].Owner = functionalities11.Owner - r.Service.Functionalities[functionalitiesCount5].Slug = functionalities11.Slug - r.Service.Functionalities[functionalitiesCount5].UpdatedAt = functionalities11.UpdatedAt - r.Service.Functionalities[functionalitiesCount5].UpdatedBy = functionalities11.UpdatedBy - } - } - r.Service.ID = types.StringPointerValue(resp.Service.ID) - if len(resp.Service.Labels) > 0 { - r.Service.Labels = make(map[string]types.String) - for key11, value15 := range resp.Service.Labels { - r.Service.Labels[key11] = types.StringValue(value15) - } - } - if resp.Service.LastImport == nil { - r.Service.LastImport = nil - } else { - r.Service.LastImport = &tfTypes.ImportsImportableResourceEntity{} - r.Service.LastImport.ImportErrors = []tfTypes.ImportsImportErrorEntity{} - if len(r.Service.LastImport.ImportErrors) > len(resp.Service.LastImport.ImportErrors) { - r.Service.LastImport.ImportErrors = r.Service.LastImport.ImportErrors[:len(resp.Service.LastImport.ImportErrors)] - } - for importErrorsCount1, importErrorsItem1 := range resp.Service.LastImport.ImportErrors { - var importErrors3 tfTypes.ImportsImportErrorEntity - if importErrorsItem1.CreatedAt != nil { - importErrors3.CreatedAt = types.StringValue(importErrorsItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - importErrors3.CreatedAt = types.StringNull() - } - if importErrorsItem1.Data == nil { - importErrors3.Data = nil - } else { - importErrors3.Data = &tfTypes.TeamEntity1{} - } - importErrors3.ID = types.StringPointerValue(importErrorsItem1.ID) - importErrors3.Message = types.StringPointerValue(importErrorsItem1.Message) - if importErrorsItem1.Resource == nil { - importErrors3.Resource = nil - } else { - importErrors3.Resource = &tfTypes.ImportsImportErrorEntityResourceEntity{} - importErrors3.Resource.Name = types.StringPointerValue(importErrorsItem1.Resource.Name) - importErrors3.Resource.ResourceID = types.StringPointerValue(importErrorsItem1.Resource.ResourceID) - importErrors3.Resource.ResourceType = types.StringPointerValue(importErrorsItem1.Resource.ResourceType) - } - if importErrorsCount1+1 > len(r.Service.LastImport.ImportErrors) { - r.Service.LastImport.ImportErrors = append(r.Service.LastImport.ImportErrors, importErrors3) - } else { - r.Service.LastImport.ImportErrors[importErrorsCount1].CreatedAt = importErrors3.CreatedAt - r.Service.LastImport.ImportErrors[importErrorsCount1].Data = importErrors3.Data - r.Service.LastImport.ImportErrors[importErrorsCount1].ID = importErrors3.ID - r.Service.LastImport.ImportErrors[importErrorsCount1].Message = importErrors3.Message - r.Service.LastImport.ImportErrors[importErrorsCount1].Resource = importErrors3.Resource - } - } - if resp.Service.LastImport.ImportedAt != nil { - r.Service.LastImport.ImportedAt = types.StringValue(resp.Service.LastImport.ImportedAt.Format(time.RFC3339Nano)) - } else { - r.Service.LastImport.ImportedAt = types.StringNull() - } - r.Service.LastImport.RemoteID = types.StringPointerValue(resp.Service.LastImport.RemoteID) - if resp.Service.LastImport.State != nil { - r.Service.LastImport.State = types.StringValue(string(*resp.Service.LastImport.State)) - } else { - r.Service.LastImport.State = types.StringNull() - } - } - r.Service.Links = []tfTypes.LinksEntity{} - if len(r.Service.Links) > len(resp.Service.Links) { - r.Service.Links = r.Service.Links[:len(resp.Service.Links)] - } - for linksCount11, linksItem11 := range resp.Service.Links { - var links23 tfTypes.LinksEntity - links23.HrefURL = types.StringPointerValue(linksItem11.HrefURL) - links23.IconURL = types.StringPointerValue(linksItem11.IconURL) - links23.ID = types.StringPointerValue(linksItem11.ID) - links23.Name = types.StringPointerValue(linksItem11.Name) - if linksCount11+1 > len(r.Service.Links) { - r.Service.Links = append(r.Service.Links, links23) - } else { - r.Service.Links[linksCount11].HrefURL = links23.HrefURL - r.Service.Links[linksCount11].IconURL = links23.IconURL - r.Service.Links[linksCount11].ID = links23.ID - r.Service.Links[linksCount11].Name = links23.Name - } - } - r.Service.ManagedBy = types.StringPointerValue(resp.Service.ManagedBy) - if resp.Service.ManagedBySettings == nil { - r.Service.ManagedBySettings = nil - } else { - r.Service.ManagedBySettings = &tfTypes.TeamEntity1{} - } - r.Service.Name = types.StringPointerValue(resp.Service.Name) - if resp.Service.Owner == nil { - r.Service.Owner = nil - } else { - r.Service.Owner = &tfTypes.TeamEntity{} - if resp.Service.Owner.CreatedAt != nil { - r.Service.Owner.CreatedAt = types.StringValue(resp.Service.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.Owner.CreatedAt = types.StringNull() - } - if resp.Service.Owner.CreatedBy == nil { - r.Service.Owner.CreatedBy = nil - } else { - r.Service.Owner.CreatedBy = &tfTypes.AuthorEntity{} - r.Service.Owner.CreatedBy.Email = types.StringPointerValue(resp.Service.Owner.CreatedBy.Email) - r.Service.Owner.CreatedBy.ID = types.StringPointerValue(resp.Service.Owner.CreatedBy.ID) - r.Service.Owner.CreatedBy.Name = types.StringPointerValue(resp.Service.Owner.CreatedBy.Name) - r.Service.Owner.CreatedBy.Source = types.StringPointerValue(resp.Service.Owner.CreatedBy.Source) - } - r.Service.Owner.Description = types.StringPointerValue(resp.Service.Owner.Description) - r.Service.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Service.Owner.Functionalities) > len(resp.Service.Owner.Functionalities) { - r.Service.Owner.Functionalities = r.Service.Owner.Functionalities[:len(resp.Service.Owner.Functionalities)] - } - for functionalitiesCount6, functionalitiesItem6 := range resp.Service.Owner.Functionalities { - var functionalities13 tfTypes.FunctionalityEntity - functionalities13.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem6.ActiveIncidents { - functionalities13.ActiveIncidents = append(functionalities13.ActiveIncidents, types.StringValue(v)) - } - functionalities13.AlertOnAdd = types.BoolPointerValue(functionalitiesItem6.AlertOnAdd) - functionalities13.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem6.AutoAddRespondingTeam) - if functionalitiesItem6.CreatedAt != nil { - functionalities13.CreatedAt = types.StringValue(functionalitiesItem6.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities13.CreatedAt = types.StringNull() - } - functionalities13.Description = types.StringPointerValue(functionalitiesItem6.Description) - functionalities13.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount12, externalResourcesItem12 := range functionalitiesItem6.ExternalResources { - var externalResources25 tfTypes.ExternalResourceEntity - externalResources25.ConnectionID = types.StringPointerValue(externalResourcesItem12.ConnectionID) - externalResources25.ConnectionName = types.StringPointerValue(externalResourcesItem12.ConnectionName) - externalResources25.ConnectionType = types.StringPointerValue(externalResourcesItem12.ConnectionType) - if externalResourcesItem12.CreatedAt != nil { - externalResources25.CreatedAt = types.StringValue(externalResourcesItem12.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources25.CreatedAt = types.StringNull() - } - externalResources25.Name = types.StringPointerValue(externalResourcesItem12.Name) - externalResources25.RemoteID = types.StringPointerValue(externalResourcesItem12.RemoteID) - externalResources25.RemoteURL = types.StringPointerValue(externalResourcesItem12.RemoteURL) - if externalResourcesItem12.UpdatedAt != nil { - externalResources25.UpdatedAt = types.StringValue(externalResourcesItem12.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources25.UpdatedAt = types.StringNull() - } - if externalResourcesCount12+1 > len(functionalities13.ExternalResources) { - functionalities13.ExternalResources = append(functionalities13.ExternalResources, externalResources25) - } else { - functionalities13.ExternalResources[externalResourcesCount12].ConnectionID = externalResources25.ConnectionID - functionalities13.ExternalResources[externalResourcesCount12].ConnectionName = externalResources25.ConnectionName - functionalities13.ExternalResources[externalResourcesCount12].ConnectionType = externalResources25.ConnectionType - functionalities13.ExternalResources[externalResourcesCount12].CreatedAt = externalResources25.CreatedAt - functionalities13.ExternalResources[externalResourcesCount12].Name = externalResources25.Name - functionalities13.ExternalResources[externalResourcesCount12].RemoteID = externalResources25.RemoteID - functionalities13.ExternalResources[externalResourcesCount12].RemoteURL = externalResources25.RemoteURL - functionalities13.ExternalResources[externalResourcesCount12].UpdatedAt = externalResources25.UpdatedAt - } - } - functionalities13.ID = types.StringPointerValue(functionalitiesItem6.ID) - if len(functionalitiesItem6.Labels) > 0 { - functionalities13.Labels = make(map[string]types.String) - for key12, value16 := range functionalitiesItem6.Labels { - functionalities13.Labels[key12] = types.StringValue(value16) - } - } - functionalities13.Links = []tfTypes.LinksEntity{} - for linksCount12, linksItem12 := range functionalitiesItem6.Links { - var links25 tfTypes.LinksEntity - links25.HrefURL = types.StringPointerValue(linksItem12.HrefURL) - links25.IconURL = types.StringPointerValue(linksItem12.IconURL) - links25.ID = types.StringPointerValue(linksItem12.ID) - links25.Name = types.StringPointerValue(linksItem12.Name) - if linksCount12+1 > len(functionalities13.Links) { - functionalities13.Links = append(functionalities13.Links, links25) - } else { - functionalities13.Links[linksCount12].HrefURL = links25.HrefURL - functionalities13.Links[linksCount12].IconURL = links25.IconURL - functionalities13.Links[linksCount12].ID = links25.ID - functionalities13.Links[linksCount12].Name = links25.Name - } - } - functionalities13.Name = types.StringPointerValue(functionalitiesItem6.Name) - if functionalitiesItem6.Owner == nil { - functionalities13.Owner = nil - } else { - functionalities13.Owner = &tfTypes.TeamEntity1{} - } - functionalities13.Slug = types.StringPointerValue(functionalitiesItem6.Slug) - if functionalitiesItem6.UpdatedAt != nil { - functionalities13.UpdatedAt = types.StringValue(functionalitiesItem6.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities13.UpdatedAt = types.StringNull() - } - if functionalitiesItem6.UpdatedBy == nil { - functionalities13.UpdatedBy = nil - } else { - functionalities13.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities13.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem6.UpdatedBy.Email) - functionalities13.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem6.UpdatedBy.ID) - functionalities13.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem6.UpdatedBy.Name) - functionalities13.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem6.UpdatedBy.Source) - } - if functionalitiesCount6+1 > len(r.Service.Owner.Functionalities) { - r.Service.Owner.Functionalities = append(r.Service.Owner.Functionalities, functionalities13) - } else { - r.Service.Owner.Functionalities[functionalitiesCount6].ActiveIncidents = functionalities13.ActiveIncidents - r.Service.Owner.Functionalities[functionalitiesCount6].AlertOnAdd = functionalities13.AlertOnAdd - r.Service.Owner.Functionalities[functionalitiesCount6].AutoAddRespondingTeam = functionalities13.AutoAddRespondingTeam - r.Service.Owner.Functionalities[functionalitiesCount6].CreatedAt = functionalities13.CreatedAt - r.Service.Owner.Functionalities[functionalitiesCount6].Description = functionalities13.Description - r.Service.Owner.Functionalities[functionalitiesCount6].ExternalResources = functionalities13.ExternalResources - r.Service.Owner.Functionalities[functionalitiesCount6].ID = functionalities13.ID - r.Service.Owner.Functionalities[functionalitiesCount6].Labels = functionalities13.Labels - r.Service.Owner.Functionalities[functionalitiesCount6].Links = functionalities13.Links - r.Service.Owner.Functionalities[functionalitiesCount6].Name = functionalities13.Name - r.Service.Owner.Functionalities[functionalitiesCount6].Owner = functionalities13.Owner - r.Service.Owner.Functionalities[functionalitiesCount6].Slug = functionalities13.Slug - r.Service.Owner.Functionalities[functionalitiesCount6].UpdatedAt = functionalities13.UpdatedAt - r.Service.Owner.Functionalities[functionalitiesCount6].UpdatedBy = functionalities13.UpdatedBy - } - } - r.Service.Owner.ID = types.StringPointerValue(resp.Service.Owner.ID) - r.Service.Owner.Memberships = []tfTypes.MembershipEntity{} - if len(r.Service.Owner.Memberships) > len(resp.Service.Owner.Memberships) { - r.Service.Owner.Memberships = r.Service.Owner.Memberships[:len(resp.Service.Owner.Memberships)] - } - for membershipsCount4, membershipsItem4 := range resp.Service.Owner.Memberships { - var memberships9 tfTypes.MembershipEntity - if membershipsItem4.DefaultIncidentRole == nil { - memberships9.DefaultIncidentRole = nil - } else { - memberships9.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem4.DefaultIncidentRole.CreatedAt != nil { - memberships9.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem4.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships9.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships9.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem4.DefaultIncidentRole.Description) - if membershipsItem4.DefaultIncidentRole.DiscardedAt != nil { - memberships9.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem4.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships9.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships9.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem4.DefaultIncidentRole.ID) - memberships9.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem4.DefaultIncidentRole.Name) - memberships9.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem4.DefaultIncidentRole.Summary) - if membershipsItem4.DefaultIncidentRole.UpdatedAt != nil { - memberships9.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem4.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships9.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem4.Schedule == nil { - memberships9.Schedule = nil - } else { - memberships9.Schedule = &tfTypes.ScheduleEntity{} - memberships9.Schedule.Discarded = types.BoolPointerValue(membershipsItem4.Schedule.Discarded) - memberships9.Schedule.ID = types.StringPointerValue(membershipsItem4.Schedule.ID) - memberships9.Schedule.Integration = types.StringPointerValue(membershipsItem4.Schedule.Integration) - memberships9.Schedule.Name = types.StringPointerValue(membershipsItem4.Schedule.Name) - } - if membershipsItem4.User == nil { - memberships9.User = nil - } else { - memberships9.User = &tfTypes.UserEntity{} - if membershipsItem4.User.CreatedAt != nil { - memberships9.User.CreatedAt = types.StringValue(membershipsItem4.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships9.User.CreatedAt = types.StringNull() - } - memberships9.User.Email = types.StringPointerValue(membershipsItem4.User.Email) - memberships9.User.ID = types.StringPointerValue(membershipsItem4.User.ID) - memberships9.User.Name = types.StringPointerValue(membershipsItem4.User.Name) - memberships9.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem4.User.SignalsEnabledNotificationTypes { - memberships9.User.SignalsEnabledNotificationTypes = append(memberships9.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships9.User.SlackLinked = types.BoolPointerValue(membershipsItem4.User.SlackLinked) - memberships9.User.SlackUserID = types.StringPointerValue(membershipsItem4.User.SlackUserID) - if membershipsItem4.User.UpdatedAt != nil { - memberships9.User.UpdatedAt = types.StringValue(membershipsItem4.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships9.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount4+1 > len(r.Service.Owner.Memberships) { - r.Service.Owner.Memberships = append(r.Service.Owner.Memberships, memberships9) - } else { - r.Service.Owner.Memberships[membershipsCount4].DefaultIncidentRole = memberships9.DefaultIncidentRole - r.Service.Owner.Memberships[membershipsCount4].Schedule = memberships9.Schedule - r.Service.Owner.Memberships[membershipsCount4].User = memberships9.User - } - } - if resp.Service.Owner.MsTeamsChannel == nil { - r.Service.Owner.MsTeamsChannel = nil - } else { - r.Service.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.Service.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.ChannelID) - r.Service.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.ChannelName) - r.Service.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.ChannelURL) - r.Service.Owner.MsTeamsChannel.ID = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.ID) - r.Service.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.MsTeamID) - r.Service.Owner.MsTeamsChannel.Status = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.Status) - r.Service.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.TeamName) - } - r.Service.Owner.Name = types.StringPointerValue(resp.Service.Owner.Name) - r.Service.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.Service.Owner.OwnedFunctionalities) > len(resp.Service.Owner.OwnedFunctionalities) { - r.Service.Owner.OwnedFunctionalities = r.Service.Owner.OwnedFunctionalities[:len(resp.Service.Owner.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount4, ownedFunctionalitiesItem4 := range resp.Service.Owner.OwnedFunctionalities { - var ownedFunctionalities9 tfTypes.FunctionalityEntity - ownedFunctionalities9.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem4.ActiveIncidents { - ownedFunctionalities9.ActiveIncidents = append(ownedFunctionalities9.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities9.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem4.AlertOnAdd) - ownedFunctionalities9.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem4.AutoAddRespondingTeam) - if ownedFunctionalitiesItem4.CreatedAt != nil { - ownedFunctionalities9.CreatedAt = types.StringValue(ownedFunctionalitiesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities9.CreatedAt = types.StringNull() - } - ownedFunctionalities9.Description = types.StringPointerValue(ownedFunctionalitiesItem4.Description) - ownedFunctionalities9.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount13, externalResourcesItem13 := range ownedFunctionalitiesItem4.ExternalResources { - var externalResources27 tfTypes.ExternalResourceEntity - externalResources27.ConnectionID = types.StringPointerValue(externalResourcesItem13.ConnectionID) - externalResources27.ConnectionName = types.StringPointerValue(externalResourcesItem13.ConnectionName) - externalResources27.ConnectionType = types.StringPointerValue(externalResourcesItem13.ConnectionType) - if externalResourcesItem13.CreatedAt != nil { - externalResources27.CreatedAt = types.StringValue(externalResourcesItem13.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources27.CreatedAt = types.StringNull() - } - externalResources27.Name = types.StringPointerValue(externalResourcesItem13.Name) - externalResources27.RemoteID = types.StringPointerValue(externalResourcesItem13.RemoteID) - externalResources27.RemoteURL = types.StringPointerValue(externalResourcesItem13.RemoteURL) - if externalResourcesItem13.UpdatedAt != nil { - externalResources27.UpdatedAt = types.StringValue(externalResourcesItem13.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources27.UpdatedAt = types.StringNull() - } - if externalResourcesCount13+1 > len(ownedFunctionalities9.ExternalResources) { - ownedFunctionalities9.ExternalResources = append(ownedFunctionalities9.ExternalResources, externalResources27) - } else { - ownedFunctionalities9.ExternalResources[externalResourcesCount13].ConnectionID = externalResources27.ConnectionID - ownedFunctionalities9.ExternalResources[externalResourcesCount13].ConnectionName = externalResources27.ConnectionName - ownedFunctionalities9.ExternalResources[externalResourcesCount13].ConnectionType = externalResources27.ConnectionType - ownedFunctionalities9.ExternalResources[externalResourcesCount13].CreatedAt = externalResources27.CreatedAt - ownedFunctionalities9.ExternalResources[externalResourcesCount13].Name = externalResources27.Name - ownedFunctionalities9.ExternalResources[externalResourcesCount13].RemoteID = externalResources27.RemoteID - ownedFunctionalities9.ExternalResources[externalResourcesCount13].RemoteURL = externalResources27.RemoteURL - ownedFunctionalities9.ExternalResources[externalResourcesCount13].UpdatedAt = externalResources27.UpdatedAt - } - } - ownedFunctionalities9.ID = types.StringPointerValue(ownedFunctionalitiesItem4.ID) - if len(ownedFunctionalitiesItem4.Labels) > 0 { - ownedFunctionalities9.Labels = make(map[string]types.String) - for key13, value17 := range ownedFunctionalitiesItem4.Labels { - ownedFunctionalities9.Labels[key13] = types.StringValue(value17) - } - } - ownedFunctionalities9.Links = []tfTypes.LinksEntity{} - for linksCount13, linksItem13 := range ownedFunctionalitiesItem4.Links { - var links27 tfTypes.LinksEntity - links27.HrefURL = types.StringPointerValue(linksItem13.HrefURL) - links27.IconURL = types.StringPointerValue(linksItem13.IconURL) - links27.ID = types.StringPointerValue(linksItem13.ID) - links27.Name = types.StringPointerValue(linksItem13.Name) - if linksCount13+1 > len(ownedFunctionalities9.Links) { - ownedFunctionalities9.Links = append(ownedFunctionalities9.Links, links27) - } else { - ownedFunctionalities9.Links[linksCount13].HrefURL = links27.HrefURL - ownedFunctionalities9.Links[linksCount13].IconURL = links27.IconURL - ownedFunctionalities9.Links[linksCount13].ID = links27.ID - ownedFunctionalities9.Links[linksCount13].Name = links27.Name - } - } - ownedFunctionalities9.Name = types.StringPointerValue(ownedFunctionalitiesItem4.Name) - if ownedFunctionalitiesItem4.Owner == nil { - ownedFunctionalities9.Owner = nil - } else { - ownedFunctionalities9.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities9.Slug = types.StringPointerValue(ownedFunctionalitiesItem4.Slug) - if ownedFunctionalitiesItem4.UpdatedAt != nil { - ownedFunctionalities9.UpdatedAt = types.StringValue(ownedFunctionalitiesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities9.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem4.UpdatedBy == nil { - ownedFunctionalities9.UpdatedBy = nil - } else { - ownedFunctionalities9.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities9.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem4.UpdatedBy.Email) - ownedFunctionalities9.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem4.UpdatedBy.ID) - ownedFunctionalities9.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem4.UpdatedBy.Name) - ownedFunctionalities9.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem4.UpdatedBy.Source) - } - if ownedFunctionalitiesCount4+1 > len(r.Service.Owner.OwnedFunctionalities) { - r.Service.Owner.OwnedFunctionalities = append(r.Service.Owner.OwnedFunctionalities, ownedFunctionalities9) - } else { - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].ActiveIncidents = ownedFunctionalities9.ActiveIncidents - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].AlertOnAdd = ownedFunctionalities9.AlertOnAdd - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].AutoAddRespondingTeam = ownedFunctionalities9.AutoAddRespondingTeam - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].CreatedAt = ownedFunctionalities9.CreatedAt - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Description = ownedFunctionalities9.Description - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].ExternalResources = ownedFunctionalities9.ExternalResources - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].ID = ownedFunctionalities9.ID - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Labels = ownedFunctionalities9.Labels - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Links = ownedFunctionalities9.Links - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Name = ownedFunctionalities9.Name - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Owner = ownedFunctionalities9.Owner - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Slug = ownedFunctionalities9.Slug - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].UpdatedAt = ownedFunctionalities9.UpdatedAt - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].UpdatedBy = ownedFunctionalities9.UpdatedBy - } - } - r.Service.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.Service.Owner.OwnedRunbooks) > len(resp.Service.Owner.OwnedRunbooks) { - r.Service.Owner.OwnedRunbooks = r.Service.Owner.OwnedRunbooks[:len(resp.Service.Owner.OwnedRunbooks)] - } - for ownedRunbooksCount4, ownedRunbooksItem4 := range resp.Service.Owner.OwnedRunbooks { - var ownedRunbooks9 tfTypes.SlimRunbookEntity - if ownedRunbooksItem4.AttachmentRule == nil { - ownedRunbooks9.AttachmentRule = nil - } else { - ownedRunbooks9.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem4.AttachmentRule.Logic == nil { - ownedRunbooks9.AttachmentRule.Logic = nil - } else { - ownedRunbooks9.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem4.AttachmentRule.UserData == nil { - ownedRunbooks9.AttachmentRule.UserData = nil - } else { - ownedRunbooks9.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks9.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem4.AttachmentRule.UserData.Label) - ownedRunbooks9.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem4.AttachmentRule.UserData.Type) - ownedRunbooks9.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem4.AttachmentRule.UserData.Value) - } - } - ownedRunbooks9.Categories = types.StringPointerValue(ownedRunbooksItem4.Categories) - if ownedRunbooksItem4.CreatedAt != nil { - ownedRunbooks9.CreatedAt = types.StringValue(ownedRunbooksItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks9.CreatedAt = types.StringNull() - } - ownedRunbooks9.Description = types.StringPointerValue(ownedRunbooksItem4.Description) - ownedRunbooks9.ID = types.StringPointerValue(ownedRunbooksItem4.ID) - ownedRunbooks9.Name = types.StringPointerValue(ownedRunbooksItem4.Name) - if ownedRunbooksItem4.Owner == nil { - ownedRunbooks9.Owner = nil - } else { - ownedRunbooks9.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks9.Summary = types.StringPointerValue(ownedRunbooksItem4.Summary) - ownedRunbooks9.Type = types.StringPointerValue(ownedRunbooksItem4.Type) - if ownedRunbooksItem4.UpdatedAt != nil { - ownedRunbooks9.UpdatedAt = types.StringValue(ownedRunbooksItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks9.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount4+1 > len(r.Service.Owner.OwnedRunbooks) { - r.Service.Owner.OwnedRunbooks = append(r.Service.Owner.OwnedRunbooks, ownedRunbooks9) - } else { - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].AttachmentRule = ownedRunbooks9.AttachmentRule - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Categories = ownedRunbooks9.Categories - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].CreatedAt = ownedRunbooks9.CreatedAt - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Description = ownedRunbooks9.Description - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].ID = ownedRunbooks9.ID - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Name = ownedRunbooks9.Name - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Owner = ownedRunbooks9.Owner - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Summary = ownedRunbooks9.Summary - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Type = ownedRunbooks9.Type - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].UpdatedAt = ownedRunbooks9.UpdatedAt - } - } - r.Service.Owner.SignalsIcalURL = types.StringPointerValue(resp.Service.Owner.SignalsIcalURL) - if resp.Service.Owner.SlackChannel == nil { - r.Service.Owner.SlackChannel = nil - } else { - r.Service.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.Service.Owner.SlackChannel.ID = types.StringPointerValue(resp.Service.Owner.SlackChannel.ID) - r.Service.Owner.SlackChannel.Name = types.StringPointerValue(resp.Service.Owner.SlackChannel.Name) - r.Service.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(resp.Service.Owner.SlackChannel.SlackChannelID) - } - r.Service.Owner.Slug = types.StringPointerValue(resp.Service.Owner.Slug) - if resp.Service.Owner.UpdatedAt != nil { - r.Service.Owner.UpdatedAt = types.StringValue(resp.Service.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.Owner.UpdatedAt = types.StringNull() - } - } - if resp.Service.ServiceChecklistUpdatedAt != nil { - r.Service.ServiceChecklistUpdatedAt = types.StringValue(resp.Service.ServiceChecklistUpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.ServiceChecklistUpdatedAt = types.StringNull() - } - if resp.Service.ServiceTier != nil { - r.Service.ServiceTier = types.Int64Value(int64(*resp.Service.ServiceTier)) - } else { - r.Service.ServiceTier = types.Int64Null() - } - r.Service.Slug = types.StringPointerValue(resp.Service.Slug) - r.Service.Teams = []tfTypes.TeamEntity{} - if len(r.Service.Teams) > len(resp.Service.Teams) { - r.Service.Teams = r.Service.Teams[:len(resp.Service.Teams)] - } - for teamsCount1, teamsItem1 := range resp.Service.Teams { - var teams3 tfTypes.TeamEntity - if teamsItem1.CreatedAt != nil { - teams3.CreatedAt = types.StringValue(teamsItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams3.CreatedAt = types.StringNull() - } - if teamsItem1.CreatedBy == nil { - teams3.CreatedBy = nil - } else { - teams3.CreatedBy = &tfTypes.AuthorEntity{} - teams3.CreatedBy.Email = types.StringPointerValue(teamsItem1.CreatedBy.Email) - teams3.CreatedBy.ID = types.StringPointerValue(teamsItem1.CreatedBy.ID) - teams3.CreatedBy.Name = types.StringPointerValue(teamsItem1.CreatedBy.Name) - teams3.CreatedBy.Source = types.StringPointerValue(teamsItem1.CreatedBy.Source) - } - teams3.Description = types.StringPointerValue(teamsItem1.Description) - teams3.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount7, functionalitiesItem7 := range teamsItem1.Functionalities { - var functionalities15 tfTypes.FunctionalityEntity - functionalities15.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem7.ActiveIncidents { - functionalities15.ActiveIncidents = append(functionalities15.ActiveIncidents, types.StringValue(v)) - } - functionalities15.AlertOnAdd = types.BoolPointerValue(functionalitiesItem7.AlertOnAdd) - functionalities15.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem7.AutoAddRespondingTeam) - if functionalitiesItem7.CreatedAt != nil { - functionalities15.CreatedAt = types.StringValue(functionalitiesItem7.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities15.CreatedAt = types.StringNull() - } - functionalities15.Description = types.StringPointerValue(functionalitiesItem7.Description) - functionalities15.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount14, externalResourcesItem14 := range functionalitiesItem7.ExternalResources { - var externalResources29 tfTypes.ExternalResourceEntity - externalResources29.ConnectionID = types.StringPointerValue(externalResourcesItem14.ConnectionID) - externalResources29.ConnectionName = types.StringPointerValue(externalResourcesItem14.ConnectionName) - externalResources29.ConnectionType = types.StringPointerValue(externalResourcesItem14.ConnectionType) - if externalResourcesItem14.CreatedAt != nil { - externalResources29.CreatedAt = types.StringValue(externalResourcesItem14.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources29.CreatedAt = types.StringNull() - } - externalResources29.Name = types.StringPointerValue(externalResourcesItem14.Name) - externalResources29.RemoteID = types.StringPointerValue(externalResourcesItem14.RemoteID) - externalResources29.RemoteURL = types.StringPointerValue(externalResourcesItem14.RemoteURL) - if externalResourcesItem14.UpdatedAt != nil { - externalResources29.UpdatedAt = types.StringValue(externalResourcesItem14.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources29.UpdatedAt = types.StringNull() - } - if externalResourcesCount14+1 > len(functionalities15.ExternalResources) { - functionalities15.ExternalResources = append(functionalities15.ExternalResources, externalResources29) - } else { - functionalities15.ExternalResources[externalResourcesCount14].ConnectionID = externalResources29.ConnectionID - functionalities15.ExternalResources[externalResourcesCount14].ConnectionName = externalResources29.ConnectionName - functionalities15.ExternalResources[externalResourcesCount14].ConnectionType = externalResources29.ConnectionType - functionalities15.ExternalResources[externalResourcesCount14].CreatedAt = externalResources29.CreatedAt - functionalities15.ExternalResources[externalResourcesCount14].Name = externalResources29.Name - functionalities15.ExternalResources[externalResourcesCount14].RemoteID = externalResources29.RemoteID - functionalities15.ExternalResources[externalResourcesCount14].RemoteURL = externalResources29.RemoteURL - functionalities15.ExternalResources[externalResourcesCount14].UpdatedAt = externalResources29.UpdatedAt - } - } - functionalities15.ID = types.StringPointerValue(functionalitiesItem7.ID) - if len(functionalitiesItem7.Labels) > 0 { - functionalities15.Labels = make(map[string]types.String) - for key14, value19 := range functionalitiesItem7.Labels { - functionalities15.Labels[key14] = types.StringValue(value19) - } - } - functionalities15.Links = []tfTypes.LinksEntity{} - for linksCount14, linksItem14 := range functionalitiesItem7.Links { - var links29 tfTypes.LinksEntity - links29.HrefURL = types.StringPointerValue(linksItem14.HrefURL) - links29.IconURL = types.StringPointerValue(linksItem14.IconURL) - links29.ID = types.StringPointerValue(linksItem14.ID) - links29.Name = types.StringPointerValue(linksItem14.Name) - if linksCount14+1 > len(functionalities15.Links) { - functionalities15.Links = append(functionalities15.Links, links29) - } else { - functionalities15.Links[linksCount14].HrefURL = links29.HrefURL - functionalities15.Links[linksCount14].IconURL = links29.IconURL - functionalities15.Links[linksCount14].ID = links29.ID - functionalities15.Links[linksCount14].Name = links29.Name - } - } - functionalities15.Name = types.StringPointerValue(functionalitiesItem7.Name) - if functionalitiesItem7.Owner == nil { - functionalities15.Owner = nil - } else { - functionalities15.Owner = &tfTypes.TeamEntity1{} - } - functionalities15.Slug = types.StringPointerValue(functionalitiesItem7.Slug) - if functionalitiesItem7.UpdatedAt != nil { - functionalities15.UpdatedAt = types.StringValue(functionalitiesItem7.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities15.UpdatedAt = types.StringNull() - } - if functionalitiesItem7.UpdatedBy == nil { - functionalities15.UpdatedBy = nil - } else { - functionalities15.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities15.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem7.UpdatedBy.Email) - functionalities15.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem7.UpdatedBy.ID) - functionalities15.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem7.UpdatedBy.Name) - functionalities15.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem7.UpdatedBy.Source) - } - if functionalitiesCount7+1 > len(teams3.Functionalities) { - teams3.Functionalities = append(teams3.Functionalities, functionalities15) - } else { - teams3.Functionalities[functionalitiesCount7].ActiveIncidents = functionalities15.ActiveIncidents - teams3.Functionalities[functionalitiesCount7].AlertOnAdd = functionalities15.AlertOnAdd - teams3.Functionalities[functionalitiesCount7].AutoAddRespondingTeam = functionalities15.AutoAddRespondingTeam - teams3.Functionalities[functionalitiesCount7].CreatedAt = functionalities15.CreatedAt - teams3.Functionalities[functionalitiesCount7].Description = functionalities15.Description - teams3.Functionalities[functionalitiesCount7].ExternalResources = functionalities15.ExternalResources - teams3.Functionalities[functionalitiesCount7].ID = functionalities15.ID - teams3.Functionalities[functionalitiesCount7].Labels = functionalities15.Labels - teams3.Functionalities[functionalitiesCount7].Links = functionalities15.Links - teams3.Functionalities[functionalitiesCount7].Name = functionalities15.Name - teams3.Functionalities[functionalitiesCount7].Owner = functionalities15.Owner - teams3.Functionalities[functionalitiesCount7].Slug = functionalities15.Slug - teams3.Functionalities[functionalitiesCount7].UpdatedAt = functionalities15.UpdatedAt - teams3.Functionalities[functionalitiesCount7].UpdatedBy = functionalities15.UpdatedBy - } - } - teams3.ID = types.StringPointerValue(teamsItem1.ID) - teams3.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount5, membershipsItem5 := range teamsItem1.Memberships { - var memberships11 tfTypes.MembershipEntity - if membershipsItem5.DefaultIncidentRole == nil { - memberships11.DefaultIncidentRole = nil - } else { - memberships11.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem5.DefaultIncidentRole.CreatedAt != nil { - memberships11.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem5.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships11.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships11.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem5.DefaultIncidentRole.Description) - if membershipsItem5.DefaultIncidentRole.DiscardedAt != nil { - memberships11.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem5.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships11.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships11.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem5.DefaultIncidentRole.ID) - memberships11.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem5.DefaultIncidentRole.Name) - memberships11.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem5.DefaultIncidentRole.Summary) - if membershipsItem5.DefaultIncidentRole.UpdatedAt != nil { - memberships11.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem5.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships11.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem5.Schedule == nil { - memberships11.Schedule = nil - } else { - memberships11.Schedule = &tfTypes.ScheduleEntity{} - memberships11.Schedule.Discarded = types.BoolPointerValue(membershipsItem5.Schedule.Discarded) - memberships11.Schedule.ID = types.StringPointerValue(membershipsItem5.Schedule.ID) - memberships11.Schedule.Integration = types.StringPointerValue(membershipsItem5.Schedule.Integration) - memberships11.Schedule.Name = types.StringPointerValue(membershipsItem5.Schedule.Name) - } - if membershipsItem5.User == nil { - memberships11.User = nil - } else { - memberships11.User = &tfTypes.UserEntity{} - if membershipsItem5.User.CreatedAt != nil { - memberships11.User.CreatedAt = types.StringValue(membershipsItem5.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships11.User.CreatedAt = types.StringNull() - } - memberships11.User.Email = types.StringPointerValue(membershipsItem5.User.Email) - memberships11.User.ID = types.StringPointerValue(membershipsItem5.User.ID) - memberships11.User.Name = types.StringPointerValue(membershipsItem5.User.Name) - memberships11.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem5.User.SignalsEnabledNotificationTypes { - memberships11.User.SignalsEnabledNotificationTypes = append(memberships11.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships11.User.SlackLinked = types.BoolPointerValue(membershipsItem5.User.SlackLinked) - memberships11.User.SlackUserID = types.StringPointerValue(membershipsItem5.User.SlackUserID) - if membershipsItem5.User.UpdatedAt != nil { - memberships11.User.UpdatedAt = types.StringValue(membershipsItem5.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships11.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount5+1 > len(teams3.Memberships) { - teams3.Memberships = append(teams3.Memberships, memberships11) - } else { - teams3.Memberships[membershipsCount5].DefaultIncidentRole = memberships11.DefaultIncidentRole - teams3.Memberships[membershipsCount5].Schedule = memberships11.Schedule - teams3.Memberships[membershipsCount5].User = memberships11.User - } - } - if teamsItem1.MsTeamsChannel == nil { - teams3.MsTeamsChannel = nil - } else { - teams3.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams3.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem1.MsTeamsChannel.ChannelID) - teams3.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem1.MsTeamsChannel.ChannelName) - teams3.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem1.MsTeamsChannel.ChannelURL) - teams3.MsTeamsChannel.ID = types.StringPointerValue(teamsItem1.MsTeamsChannel.ID) - teams3.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem1.MsTeamsChannel.MsTeamID) - teams3.MsTeamsChannel.Status = types.StringPointerValue(teamsItem1.MsTeamsChannel.Status) - teams3.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem1.MsTeamsChannel.TeamName) - } - teams3.Name = types.StringPointerValue(teamsItem1.Name) - teams3.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount5, ownedFunctionalitiesItem5 := range teamsItem1.OwnedFunctionalities { - var ownedFunctionalities11 tfTypes.FunctionalityEntity - ownedFunctionalities11.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem5.ActiveIncidents { - ownedFunctionalities11.ActiveIncidents = append(ownedFunctionalities11.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities11.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem5.AlertOnAdd) - ownedFunctionalities11.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem5.AutoAddRespondingTeam) - if ownedFunctionalitiesItem5.CreatedAt != nil { - ownedFunctionalities11.CreatedAt = types.StringValue(ownedFunctionalitiesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities11.CreatedAt = types.StringNull() - } - ownedFunctionalities11.Description = types.StringPointerValue(ownedFunctionalitiesItem5.Description) - ownedFunctionalities11.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount15, externalResourcesItem15 := range ownedFunctionalitiesItem5.ExternalResources { - var externalResources31 tfTypes.ExternalResourceEntity - externalResources31.ConnectionID = types.StringPointerValue(externalResourcesItem15.ConnectionID) - externalResources31.ConnectionName = types.StringPointerValue(externalResourcesItem15.ConnectionName) - externalResources31.ConnectionType = types.StringPointerValue(externalResourcesItem15.ConnectionType) - if externalResourcesItem15.CreatedAt != nil { - externalResources31.CreatedAt = types.StringValue(externalResourcesItem15.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources31.CreatedAt = types.StringNull() - } - externalResources31.Name = types.StringPointerValue(externalResourcesItem15.Name) - externalResources31.RemoteID = types.StringPointerValue(externalResourcesItem15.RemoteID) - externalResources31.RemoteURL = types.StringPointerValue(externalResourcesItem15.RemoteURL) - if externalResourcesItem15.UpdatedAt != nil { - externalResources31.UpdatedAt = types.StringValue(externalResourcesItem15.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources31.UpdatedAt = types.StringNull() - } - if externalResourcesCount15+1 > len(ownedFunctionalities11.ExternalResources) { - ownedFunctionalities11.ExternalResources = append(ownedFunctionalities11.ExternalResources, externalResources31) - } else { - ownedFunctionalities11.ExternalResources[externalResourcesCount15].ConnectionID = externalResources31.ConnectionID - ownedFunctionalities11.ExternalResources[externalResourcesCount15].ConnectionName = externalResources31.ConnectionName - ownedFunctionalities11.ExternalResources[externalResourcesCount15].ConnectionType = externalResources31.ConnectionType - ownedFunctionalities11.ExternalResources[externalResourcesCount15].CreatedAt = externalResources31.CreatedAt - ownedFunctionalities11.ExternalResources[externalResourcesCount15].Name = externalResources31.Name - ownedFunctionalities11.ExternalResources[externalResourcesCount15].RemoteID = externalResources31.RemoteID - ownedFunctionalities11.ExternalResources[externalResourcesCount15].RemoteURL = externalResources31.RemoteURL - ownedFunctionalities11.ExternalResources[externalResourcesCount15].UpdatedAt = externalResources31.UpdatedAt - } - } - ownedFunctionalities11.ID = types.StringPointerValue(ownedFunctionalitiesItem5.ID) - if len(ownedFunctionalitiesItem5.Labels) > 0 { - ownedFunctionalities11.Labels = make(map[string]types.String) - for key15, value20 := range ownedFunctionalitiesItem5.Labels { - ownedFunctionalities11.Labels[key15] = types.StringValue(value20) - } - } - ownedFunctionalities11.Links = []tfTypes.LinksEntity{} - for linksCount15, linksItem15 := range ownedFunctionalitiesItem5.Links { - var links31 tfTypes.LinksEntity - links31.HrefURL = types.StringPointerValue(linksItem15.HrefURL) - links31.IconURL = types.StringPointerValue(linksItem15.IconURL) - links31.ID = types.StringPointerValue(linksItem15.ID) - links31.Name = types.StringPointerValue(linksItem15.Name) - if linksCount15+1 > len(ownedFunctionalities11.Links) { - ownedFunctionalities11.Links = append(ownedFunctionalities11.Links, links31) - } else { - ownedFunctionalities11.Links[linksCount15].HrefURL = links31.HrefURL - ownedFunctionalities11.Links[linksCount15].IconURL = links31.IconURL - ownedFunctionalities11.Links[linksCount15].ID = links31.ID - ownedFunctionalities11.Links[linksCount15].Name = links31.Name - } - } - ownedFunctionalities11.Name = types.StringPointerValue(ownedFunctionalitiesItem5.Name) - if ownedFunctionalitiesItem5.Owner == nil { - ownedFunctionalities11.Owner = nil - } else { - ownedFunctionalities11.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities11.Slug = types.StringPointerValue(ownedFunctionalitiesItem5.Slug) - if ownedFunctionalitiesItem5.UpdatedAt != nil { - ownedFunctionalities11.UpdatedAt = types.StringValue(ownedFunctionalitiesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities11.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem5.UpdatedBy == nil { - ownedFunctionalities11.UpdatedBy = nil - } else { - ownedFunctionalities11.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities11.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem5.UpdatedBy.Email) - ownedFunctionalities11.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem5.UpdatedBy.ID) - ownedFunctionalities11.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem5.UpdatedBy.Name) - ownedFunctionalities11.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem5.UpdatedBy.Source) - } - if ownedFunctionalitiesCount5+1 > len(teams3.OwnedFunctionalities) { - teams3.OwnedFunctionalities = append(teams3.OwnedFunctionalities, ownedFunctionalities11) - } else { - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].ActiveIncidents = ownedFunctionalities11.ActiveIncidents - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].AlertOnAdd = ownedFunctionalities11.AlertOnAdd - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].AutoAddRespondingTeam = ownedFunctionalities11.AutoAddRespondingTeam - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].CreatedAt = ownedFunctionalities11.CreatedAt - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Description = ownedFunctionalities11.Description - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].ExternalResources = ownedFunctionalities11.ExternalResources - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].ID = ownedFunctionalities11.ID - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Labels = ownedFunctionalities11.Labels - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Links = ownedFunctionalities11.Links - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Name = ownedFunctionalities11.Name - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Owner = ownedFunctionalities11.Owner - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Slug = ownedFunctionalities11.Slug - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].UpdatedAt = ownedFunctionalities11.UpdatedAt - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].UpdatedBy = ownedFunctionalities11.UpdatedBy - } - } - teams3.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount5, ownedRunbooksItem5 := range teamsItem1.OwnedRunbooks { - var ownedRunbooks11 tfTypes.SlimRunbookEntity - if ownedRunbooksItem5.AttachmentRule == nil { - ownedRunbooks11.AttachmentRule = nil - } else { - ownedRunbooks11.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem5.AttachmentRule.Logic == nil { - ownedRunbooks11.AttachmentRule.Logic = nil - } else { - ownedRunbooks11.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem5.AttachmentRule.UserData == nil { - ownedRunbooks11.AttachmentRule.UserData = nil - } else { - ownedRunbooks11.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks11.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem5.AttachmentRule.UserData.Label) - ownedRunbooks11.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem5.AttachmentRule.UserData.Type) - ownedRunbooks11.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem5.AttachmentRule.UserData.Value) - } - } - ownedRunbooks11.Categories = types.StringPointerValue(ownedRunbooksItem5.Categories) - if ownedRunbooksItem5.CreatedAt != nil { - ownedRunbooks11.CreatedAt = types.StringValue(ownedRunbooksItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks11.CreatedAt = types.StringNull() - } - ownedRunbooks11.Description = types.StringPointerValue(ownedRunbooksItem5.Description) - ownedRunbooks11.ID = types.StringPointerValue(ownedRunbooksItem5.ID) - ownedRunbooks11.Name = types.StringPointerValue(ownedRunbooksItem5.Name) - if ownedRunbooksItem5.Owner == nil { - ownedRunbooks11.Owner = nil - } else { - ownedRunbooks11.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks11.Summary = types.StringPointerValue(ownedRunbooksItem5.Summary) - ownedRunbooks11.Type = types.StringPointerValue(ownedRunbooksItem5.Type) - if ownedRunbooksItem5.UpdatedAt != nil { - ownedRunbooks11.UpdatedAt = types.StringValue(ownedRunbooksItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks11.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount5+1 > len(teams3.OwnedRunbooks) { - teams3.OwnedRunbooks = append(teams3.OwnedRunbooks, ownedRunbooks11) - } else { - teams3.OwnedRunbooks[ownedRunbooksCount5].AttachmentRule = ownedRunbooks11.AttachmentRule - teams3.OwnedRunbooks[ownedRunbooksCount5].Categories = ownedRunbooks11.Categories - teams3.OwnedRunbooks[ownedRunbooksCount5].CreatedAt = ownedRunbooks11.CreatedAt - teams3.OwnedRunbooks[ownedRunbooksCount5].Description = ownedRunbooks11.Description - teams3.OwnedRunbooks[ownedRunbooksCount5].ID = ownedRunbooks11.ID - teams3.OwnedRunbooks[ownedRunbooksCount5].Name = ownedRunbooks11.Name - teams3.OwnedRunbooks[ownedRunbooksCount5].Owner = ownedRunbooks11.Owner - teams3.OwnedRunbooks[ownedRunbooksCount5].Summary = ownedRunbooks11.Summary - teams3.OwnedRunbooks[ownedRunbooksCount5].Type = ownedRunbooks11.Type - teams3.OwnedRunbooks[ownedRunbooksCount5].UpdatedAt = ownedRunbooks11.UpdatedAt - } - } - teams3.SignalsIcalURL = types.StringPointerValue(teamsItem1.SignalsIcalURL) - if teamsItem1.SlackChannel == nil { - teams3.SlackChannel = nil - } else { - teams3.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams3.SlackChannel.ID = types.StringPointerValue(teamsItem1.SlackChannel.ID) - teams3.SlackChannel.Name = types.StringPointerValue(teamsItem1.SlackChannel.Name) - teams3.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem1.SlackChannel.SlackChannelID) - } - teams3.Slug = types.StringPointerValue(teamsItem1.Slug) - if teamsItem1.UpdatedAt != nil { - teams3.UpdatedAt = types.StringValue(teamsItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams3.UpdatedAt = types.StringNull() - } - if teamsCount1+1 > len(r.Service.Teams) { - r.Service.Teams = append(r.Service.Teams, teams3) - } else { - r.Service.Teams[teamsCount1].CreatedAt = teams3.CreatedAt - r.Service.Teams[teamsCount1].CreatedBy = teams3.CreatedBy - r.Service.Teams[teamsCount1].Description = teams3.Description - r.Service.Teams[teamsCount1].Functionalities = teams3.Functionalities - r.Service.Teams[teamsCount1].ID = teams3.ID - r.Service.Teams[teamsCount1].Memberships = teams3.Memberships - r.Service.Teams[teamsCount1].MsTeamsChannel = teams3.MsTeamsChannel - r.Service.Teams[teamsCount1].Name = teams3.Name - r.Service.Teams[teamsCount1].OwnedFunctionalities = teams3.OwnedFunctionalities - r.Service.Teams[teamsCount1].OwnedRunbooks = teams3.OwnedRunbooks - r.Service.Teams[teamsCount1].SignalsIcalURL = teams3.SignalsIcalURL - r.Service.Teams[teamsCount1].SlackChannel = teams3.SlackChannel - r.Service.Teams[teamsCount1].Slug = teams3.Slug - r.Service.Teams[teamsCount1].UpdatedAt = teams3.UpdatedAt - } - } - if resp.Service.UpdatedAt != nil { - r.Service.UpdatedAt = types.StringValue(resp.Service.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.UpdatedAt = types.StringNull() - } - if resp.Service.UpdatedBy == nil { - r.Service.UpdatedBy = nil - } else { - r.Service.UpdatedBy = &tfTypes.AuthorEntity{} - r.Service.UpdatedBy.Email = types.StringPointerValue(resp.Service.UpdatedBy.Email) - r.Service.UpdatedBy.ID = types.StringPointerValue(resp.Service.UpdatedBy.ID) - r.Service.UpdatedBy.Name = types.StringPointerValue(resp.Service.UpdatedBy.Name) - r.Service.UpdatedBy.Source = types.StringPointerValue(resp.Service.UpdatedBy.Source) - } - } - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} diff --git a/internal/provider/servicedependency_resource.go b/internal/provider/servicedependency_resource.go deleted file mode 100644 index ea185ae..0000000 --- a/internal/provider/servicedependency_resource.go +++ /dev/null @@ -1,4118 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &ServiceDependencyResource{} -var _ resource.ResourceWithImportState = &ServiceDependencyResource{} - -func NewServiceDependencyResource() resource.Resource { - return &ServiceDependencyResource{} -} - -// ServiceDependencyResource defines the resource implementation. -type ServiceDependencyResource struct { - client *sdk.Firehydrant -} - -// ServiceDependencyResourceModel describes the resource data model. -type ServiceDependencyResourceModel struct { - ConnectedService *tfTypes.ServiceEntity `tfsdk:"connected_service"` - ConnectedServiceID types.String `tfsdk:"connected_service_id"` - CreatedAt types.String `tfsdk:"created_at"` - ID types.String `tfsdk:"id"` - Notes types.String `tfsdk:"notes"` - Service *tfTypes.ServiceEntity `tfsdk:"service"` - ServiceID types.String `tfsdk:"service_id"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *ServiceDependencyResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_service_dependency" -} - -func (r *ServiceDependencyResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "ServiceDependency Resource", - Attributes: map[string]schema.Attribute{ - "connected_service": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "allowed_params": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "checklists": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `List of checklists associated with a service`, - }, - "completed_checks": schema.Int64Attribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - Description: `List of functionalities attached to the service`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "last_import": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "import_errors": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "data": schema.SingleNestedAttribute{ - Computed: true, - Description: `Additional error data`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "resource": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Computed: true, - }, - "resource_id": schema.StringAttribute{ - Computed: true, - }, - "resource_type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "imported_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["selected", "skipped", "imported", "errored"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "selected", - "skipped", - "imported", - "errored", - ), - }, - }, - }, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this service.`, - }, - "managed_by": schema.StringAttribute{ - Computed: true, - Description: `If set, this field indicates that the service is managed by an integration and thus cannot be set manually`, - }, - "managed_by_settings": schema.SingleNestedAttribute{ - Computed: true, - Description: `Indicates the settings of the catalog that manages this service`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `TeamEntity model`, - }, - "service_checklist_updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "service_tier": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `List of teams attached to the service`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - Description: `ServiceEntity model`, - }, - "connected_service_id": schema.StringAttribute{ - Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - }, - Description: `Requires replacement if changed.`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "notes": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `A note to describe the service dependency relationship`, - }, - "service": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "allowed_params": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "checklists": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `List of checklists associated with a service`, - }, - "completed_checks": schema.Int64Attribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - Description: `List of functionalities attached to the service`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "last_import": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "import_errors": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "data": schema.SingleNestedAttribute{ - Computed: true, - Description: `Additional error data`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "resource": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Computed: true, - }, - "resource_id": schema.StringAttribute{ - Computed: true, - }, - "resource_type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "imported_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["selected", "skipped", "imported", "errored"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "selected", - "skipped", - "imported", - "errored", - ), - }, - }, - }, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this service.`, - }, - "managed_by": schema.StringAttribute{ - Computed: true, - Description: `If set, this field indicates that the service is managed by an integration and thus cannot be set manually`, - }, - "managed_by_settings": schema.SingleNestedAttribute{ - Computed: true, - Description: `Indicates the settings of the catalog that manages this service`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `TeamEntity model`, - }, - "service_checklist_updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "service_tier": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `List of teams attached to the service`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - Description: `ServiceEntity model`, - }, - "service_id": schema.StringAttribute{ - Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - }, - Description: `Requires replacement if changed.`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *ServiceDependencyResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *ServiceDependencyResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *ServiceDependencyResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1ServiceDependencies() - res, err := r.client.ServiceDependencies.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceDependencyEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceDependencyEntity(res.ServiceDependencyEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var serviceDependencyID string - serviceDependencyID = data.ID.ValueString() - - request1 := operations.GetV1ServiceDependenciesServiceDependencyIDRequest{ - ServiceDependencyID: serviceDependencyID, - } - res1, err := r.client.ServiceDependencies.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.ServiceDependencyEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedServiceDependencyEntity(res1.ServiceDependencyEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ServiceDependencyResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *ServiceDependencyResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var serviceDependencyID string - serviceDependencyID = data.ID.ValueString() - - request := operations.GetV1ServiceDependenciesServiceDependencyIDRequest{ - ServiceDependencyID: serviceDependencyID, - } - res, err := r.client.ServiceDependencies.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceDependencyEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceDependencyEntity(res.ServiceDependencyEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ServiceDependencyResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *ServiceDependencyResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var serviceDependencyID string - serviceDependencyID = data.ID.ValueString() - - patchV1ServiceDependenciesServiceDependencyID := *data.ToSharedPatchV1ServiceDependenciesServiceDependencyID() - request := operations.PatchV1ServiceDependenciesServiceDependencyIDRequest{ - ServiceDependencyID: serviceDependencyID, - PatchV1ServiceDependenciesServiceDependencyID: patchV1ServiceDependenciesServiceDependencyID, - } - res, err := r.client.ServiceDependencies.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceDependencyEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceDependencyEntity(res.ServiceDependencyEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *ServiceDependencyResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *ServiceDependencyResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var serviceDependencyID string - serviceDependencyID = data.ID.ValueString() - - request := operations.DeleteV1ServiceDependenciesServiceDependencyIDRequest{ - ServiceDependencyID: serviceDependencyID, - } - res, err := r.client.ServiceDependencies.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *ServiceDependencyResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/servicedependency_resource_sdk.go b/internal/provider/servicedependency_resource_sdk.go deleted file mode 100644 index 217beb5..0000000 --- a/internal/provider/servicedependency_resource_sdk.go +++ /dev/null @@ -1,3143 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *ServiceDependencyResourceModel) ToSharedPostV1ServiceDependencies() *shared.PostV1ServiceDependencies { - var serviceID string - serviceID = r.ServiceID.ValueString() - - var connectedServiceID string - connectedServiceID = r.ConnectedServiceID.ValueString() - - notes := new(string) - if !r.Notes.IsUnknown() && !r.Notes.IsNull() { - *notes = r.Notes.ValueString() - } else { - notes = nil - } - out := shared.PostV1ServiceDependencies{ - ServiceID: serviceID, - ConnectedServiceID: connectedServiceID, - Notes: notes, - } - return &out -} - -func (r *ServiceDependencyResourceModel) RefreshFromSharedServiceDependencyEntity(resp *shared.ServiceDependencyEntity) { - if resp != nil { - if resp.ConnectedService == nil { - r.ConnectedService = nil - } else { - r.ConnectedService = &tfTypes.ServiceEntity{} - r.ConnectedService.ActiveIncidents = []types.String{} - for _, v := range resp.ConnectedService.ActiveIncidents { - r.ConnectedService.ActiveIncidents = append(r.ConnectedService.ActiveIncidents, types.StringValue(v)) - } - r.ConnectedService.AlertOnAdd = types.BoolPointerValue(resp.ConnectedService.AlertOnAdd) - r.ConnectedService.AllowedParams = []types.String{} - for _, v := range resp.ConnectedService.AllowedParams { - r.ConnectedService.AllowedParams = append(r.ConnectedService.AllowedParams, types.StringValue(v)) - } - r.ConnectedService.AutoAddRespondingTeam = types.BoolPointerValue(resp.ConnectedService.AutoAddRespondingTeam) - r.ConnectedService.Checklists = []tfTypes.Checklists{} - if len(r.ConnectedService.Checklists) > len(resp.ConnectedService.Checklists) { - r.ConnectedService.Checklists = r.ConnectedService.Checklists[:len(resp.ConnectedService.Checklists)] - } - for checklistsCount, checklistsItem := range resp.ConnectedService.Checklists { - var checklists1 tfTypes.Checklists - checklists1.Checks = []tfTypes.ChecklistCheckEntity{} - for checksCount, checksItem := range checklistsItem.Checks { - var checks1 tfTypes.ChecklistCheckEntity - checks1.Description = types.StringPointerValue(checksItem.Description) - checks1.ID = types.StringPointerValue(checksItem.ID) - checks1.Name = types.StringPointerValue(checksItem.Name) - checks1.Status = types.BoolPointerValue(checksItem.Status) - if checksCount+1 > len(checklists1.Checks) { - checklists1.Checks = append(checklists1.Checks, checks1) - } else { - checklists1.Checks[checksCount].Description = checks1.Description - checklists1.Checks[checksCount].ID = checks1.ID - checklists1.Checks[checksCount].Name = checks1.Name - checklists1.Checks[checksCount].Status = checks1.Status - } - } - checklists1.CreatedAt = types.StringPointerValue(checklistsItem.CreatedAt) - checklists1.Description = types.StringPointerValue(checklistsItem.Description) - checklists1.ID = types.StringPointerValue(checklistsItem.ID) - checklists1.Name = types.StringPointerValue(checklistsItem.Name) - if checklistsItem.Owner == nil { - checklists1.Owner = nil - } else { - checklists1.Owner = &tfTypes.TeamEntity{} - if checklistsItem.Owner.CreatedAt != nil { - checklists1.Owner.CreatedAt = types.StringValue(checklistsItem.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.CreatedAt = types.StringNull() - } - if checklistsItem.Owner.CreatedBy == nil { - checklists1.Owner.CreatedBy = nil - } else { - checklists1.Owner.CreatedBy = &tfTypes.AuthorEntity{} - checklists1.Owner.CreatedBy.Email = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Email) - checklists1.Owner.CreatedBy.ID = types.StringPointerValue(checklistsItem.Owner.CreatedBy.ID) - checklists1.Owner.CreatedBy.Name = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Name) - checklists1.Owner.CreatedBy.Source = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Source) - } - checklists1.Owner.Description = types.StringPointerValue(checklistsItem.Owner.Description) - checklists1.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount, functionalitiesItem := range checklistsItem.Owner.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(checklists1.Owner.Functionalities) { - checklists1.Owner.Functionalities = append(checklists1.Owner.Functionalities, functionalities1) - } else { - checklists1.Owner.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - checklists1.Owner.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - checklists1.Owner.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - checklists1.Owner.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - checklists1.Owner.Functionalities[functionalitiesCount].Description = functionalities1.Description - checklists1.Owner.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - checklists1.Owner.Functionalities[functionalitiesCount].ID = functionalities1.ID - checklists1.Owner.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - checklists1.Owner.Functionalities[functionalitiesCount].Links = functionalities1.Links - checklists1.Owner.Functionalities[functionalitiesCount].Name = functionalities1.Name - checklists1.Owner.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - checklists1.Owner.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - checklists1.Owner.ID = types.StringPointerValue(checklistsItem.Owner.ID) - checklists1.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range checklistsItem.Owner.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(checklists1.Owner.Memberships) { - checklists1.Owner.Memberships = append(checklists1.Owner.Memberships, memberships1) - } else { - checklists1.Owner.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - checklists1.Owner.Memberships[membershipsCount].Schedule = memberships1.Schedule - checklists1.Owner.Memberships[membershipsCount].User = memberships1.User - } - } - if checklistsItem.Owner.MsTeamsChannel == nil { - checklists1.Owner.MsTeamsChannel = nil - } else { - checklists1.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - checklists1.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelID) - checklists1.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelName) - checklists1.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelURL) - checklists1.Owner.MsTeamsChannel.ID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ID) - checklists1.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.MsTeamID) - checklists1.Owner.MsTeamsChannel.Status = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.Status) - checklists1.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.TeamName) - } - checklists1.Owner.Name = types.StringPointerValue(checklistsItem.Owner.Name) - checklists1.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range checklistsItem.Owner.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(checklists1.Owner.OwnedFunctionalities) { - checklists1.Owner.OwnedFunctionalities = append(checklists1.Owner.OwnedFunctionalities, ownedFunctionalities1) - } else { - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - checklists1.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range checklistsItem.Owner.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(checklists1.Owner.OwnedRunbooks) { - checklists1.Owner.OwnedRunbooks = append(checklists1.Owner.OwnedRunbooks, ownedRunbooks1) - } else { - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - checklists1.Owner.SignalsIcalURL = types.StringPointerValue(checklistsItem.Owner.SignalsIcalURL) - if checklistsItem.Owner.SlackChannel == nil { - checklists1.Owner.SlackChannel = nil - } else { - checklists1.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - checklists1.Owner.SlackChannel.ID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.ID) - checklists1.Owner.SlackChannel.Name = types.StringPointerValue(checklistsItem.Owner.SlackChannel.Name) - checklists1.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.SlackChannelID) - } - checklists1.Owner.Slug = types.StringPointerValue(checklistsItem.Owner.Slug) - if checklistsItem.Owner.UpdatedAt != nil { - checklists1.Owner.UpdatedAt = types.StringValue(checklistsItem.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.UpdatedAt = types.StringNull() - } - } - if checklistsItem.UpdatedAt != nil { - checklists1.UpdatedAt = types.StringValue(checklistsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.UpdatedAt = types.StringNull() - } - if checklistsCount+1 > len(r.ConnectedService.Checklists) { - r.ConnectedService.Checklists = append(r.ConnectedService.Checklists, checklists1) - } else { - r.ConnectedService.Checklists[checklistsCount].Checks = checklists1.Checks - r.ConnectedService.Checklists[checklistsCount].CreatedAt = checklists1.CreatedAt - r.ConnectedService.Checklists[checklistsCount].Description = checklists1.Description - r.ConnectedService.Checklists[checklistsCount].ID = checklists1.ID - r.ConnectedService.Checklists[checklistsCount].Name = checklists1.Name - r.ConnectedService.Checklists[checklistsCount].Owner = checklists1.Owner - r.ConnectedService.Checklists[checklistsCount].UpdatedAt = checklists1.UpdatedAt - } - } - if resp.ConnectedService.CompletedChecks != nil { - r.ConnectedService.CompletedChecks = types.Int64Value(int64(*resp.ConnectedService.CompletedChecks)) - } else { - r.ConnectedService.CompletedChecks = types.Int64Null() - } - if resp.ConnectedService.CreatedAt != nil { - r.ConnectedService.CreatedAt = types.StringValue(resp.ConnectedService.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.CreatedAt = types.StringNull() - } - r.ConnectedService.Description = types.StringPointerValue(resp.ConnectedService.Description) - r.ConnectedService.ExternalResources = []tfTypes.ExternalResourceEntity{} - if len(r.ConnectedService.ExternalResources) > len(resp.ConnectedService.ExternalResources) { - r.ConnectedService.ExternalResources = r.ConnectedService.ExternalResources[:len(resp.ConnectedService.ExternalResources)] - } - for externalResourcesCount2, externalResourcesItem2 := range resp.ConnectedService.ExternalResources { - var externalResources5 tfTypes.ExternalResourceEntity - externalResources5.ConnectionID = types.StringPointerValue(externalResourcesItem2.ConnectionID) - externalResources5.ConnectionName = types.StringPointerValue(externalResourcesItem2.ConnectionName) - externalResources5.ConnectionType = types.StringPointerValue(externalResourcesItem2.ConnectionType) - if externalResourcesItem2.CreatedAt != nil { - externalResources5.CreatedAt = types.StringValue(externalResourcesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.CreatedAt = types.StringNull() - } - externalResources5.Name = types.StringPointerValue(externalResourcesItem2.Name) - externalResources5.RemoteID = types.StringPointerValue(externalResourcesItem2.RemoteID) - externalResources5.RemoteURL = types.StringPointerValue(externalResourcesItem2.RemoteURL) - if externalResourcesItem2.UpdatedAt != nil { - externalResources5.UpdatedAt = types.StringValue(externalResourcesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.UpdatedAt = types.StringNull() - } - if externalResourcesCount2+1 > len(r.ConnectedService.ExternalResources) { - r.ConnectedService.ExternalResources = append(r.ConnectedService.ExternalResources, externalResources5) - } else { - r.ConnectedService.ExternalResources[externalResourcesCount2].ConnectionID = externalResources5.ConnectionID - r.ConnectedService.ExternalResources[externalResourcesCount2].ConnectionName = externalResources5.ConnectionName - r.ConnectedService.ExternalResources[externalResourcesCount2].ConnectionType = externalResources5.ConnectionType - r.ConnectedService.ExternalResources[externalResourcesCount2].CreatedAt = externalResources5.CreatedAt - r.ConnectedService.ExternalResources[externalResourcesCount2].Name = externalResources5.Name - r.ConnectedService.ExternalResources[externalResourcesCount2].RemoteID = externalResources5.RemoteID - r.ConnectedService.ExternalResources[externalResourcesCount2].RemoteURL = externalResources5.RemoteURL - r.ConnectedService.ExternalResources[externalResourcesCount2].UpdatedAt = externalResources5.UpdatedAt - } - } - r.ConnectedService.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.ConnectedService.Functionalities) > len(resp.ConnectedService.Functionalities) { - r.ConnectedService.Functionalities = r.ConnectedService.Functionalities[:len(resp.ConnectedService.Functionalities)] - } - for functionalitiesCount1, functionalitiesItem1 := range resp.ConnectedService.Functionalities { - var functionalities3 tfTypes.FunctionalityEntity - functionalities3.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem1.ActiveIncidents { - functionalities3.ActiveIncidents = append(functionalities3.ActiveIncidents, types.StringValue(v)) - } - functionalities3.AlertOnAdd = types.BoolPointerValue(functionalitiesItem1.AlertOnAdd) - functionalities3.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem1.AutoAddRespondingTeam) - if functionalitiesItem1.CreatedAt != nil { - functionalities3.CreatedAt = types.StringValue(functionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.CreatedAt = types.StringNull() - } - functionalities3.Description = types.StringPointerValue(functionalitiesItem1.Description) - functionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount3, externalResourcesItem3 := range functionalitiesItem1.ExternalResources { - var externalResources7 tfTypes.ExternalResourceEntity - externalResources7.ConnectionID = types.StringPointerValue(externalResourcesItem3.ConnectionID) - externalResources7.ConnectionName = types.StringPointerValue(externalResourcesItem3.ConnectionName) - externalResources7.ConnectionType = types.StringPointerValue(externalResourcesItem3.ConnectionType) - if externalResourcesItem3.CreatedAt != nil { - externalResources7.CreatedAt = types.StringValue(externalResourcesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.CreatedAt = types.StringNull() - } - externalResources7.Name = types.StringPointerValue(externalResourcesItem3.Name) - externalResources7.RemoteID = types.StringPointerValue(externalResourcesItem3.RemoteID) - externalResources7.RemoteURL = types.StringPointerValue(externalResourcesItem3.RemoteURL) - if externalResourcesItem3.UpdatedAt != nil { - externalResources7.UpdatedAt = types.StringValue(externalResourcesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.UpdatedAt = types.StringNull() - } - if externalResourcesCount3+1 > len(functionalities3.ExternalResources) { - functionalities3.ExternalResources = append(functionalities3.ExternalResources, externalResources7) - } else { - functionalities3.ExternalResources[externalResourcesCount3].ConnectionID = externalResources7.ConnectionID - functionalities3.ExternalResources[externalResourcesCount3].ConnectionName = externalResources7.ConnectionName - functionalities3.ExternalResources[externalResourcesCount3].ConnectionType = externalResources7.ConnectionType - functionalities3.ExternalResources[externalResourcesCount3].CreatedAt = externalResources7.CreatedAt - functionalities3.ExternalResources[externalResourcesCount3].Name = externalResources7.Name - functionalities3.ExternalResources[externalResourcesCount3].RemoteID = externalResources7.RemoteID - functionalities3.ExternalResources[externalResourcesCount3].RemoteURL = externalResources7.RemoteURL - functionalities3.ExternalResources[externalResourcesCount3].UpdatedAt = externalResources7.UpdatedAt - } - } - functionalities3.ID = types.StringPointerValue(functionalitiesItem1.ID) - if len(functionalitiesItem1.Labels) > 0 { - functionalities3.Labels = make(map[string]types.String) - for key2, value3 := range functionalitiesItem1.Labels { - functionalities3.Labels[key2] = types.StringValue(value3) - } - } - functionalities3.Links = []tfTypes.LinksEntity{} - for linksCount2, linksItem2 := range functionalitiesItem1.Links { - var links5 tfTypes.LinksEntity - links5.HrefURL = types.StringPointerValue(linksItem2.HrefURL) - links5.IconURL = types.StringPointerValue(linksItem2.IconURL) - links5.ID = types.StringPointerValue(linksItem2.ID) - links5.Name = types.StringPointerValue(linksItem2.Name) - if linksCount2+1 > len(functionalities3.Links) { - functionalities3.Links = append(functionalities3.Links, links5) - } else { - functionalities3.Links[linksCount2].HrefURL = links5.HrefURL - functionalities3.Links[linksCount2].IconURL = links5.IconURL - functionalities3.Links[linksCount2].ID = links5.ID - functionalities3.Links[linksCount2].Name = links5.Name - } - } - functionalities3.Name = types.StringPointerValue(functionalitiesItem1.Name) - if functionalitiesItem1.Owner == nil { - functionalities3.Owner = nil - } else { - functionalities3.Owner = &tfTypes.TeamEntity1{} - } - functionalities3.Slug = types.StringPointerValue(functionalitiesItem1.Slug) - if functionalitiesItem1.UpdatedAt != nil { - functionalities3.UpdatedAt = types.StringValue(functionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.UpdatedAt = types.StringNull() - } - if functionalitiesItem1.UpdatedBy == nil { - functionalities3.UpdatedBy = nil - } else { - functionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities3.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Email) - functionalities3.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem1.UpdatedBy.ID) - functionalities3.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Name) - functionalities3.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Source) - } - if functionalitiesCount1+1 > len(r.ConnectedService.Functionalities) { - r.ConnectedService.Functionalities = append(r.ConnectedService.Functionalities, functionalities3) - } else { - r.ConnectedService.Functionalities[functionalitiesCount1].ActiveIncidents = functionalities3.ActiveIncidents - r.ConnectedService.Functionalities[functionalitiesCount1].AlertOnAdd = functionalities3.AlertOnAdd - r.ConnectedService.Functionalities[functionalitiesCount1].AutoAddRespondingTeam = functionalities3.AutoAddRespondingTeam - r.ConnectedService.Functionalities[functionalitiesCount1].CreatedAt = functionalities3.CreatedAt - r.ConnectedService.Functionalities[functionalitiesCount1].Description = functionalities3.Description - r.ConnectedService.Functionalities[functionalitiesCount1].ExternalResources = functionalities3.ExternalResources - r.ConnectedService.Functionalities[functionalitiesCount1].ID = functionalities3.ID - r.ConnectedService.Functionalities[functionalitiesCount1].Labels = functionalities3.Labels - r.ConnectedService.Functionalities[functionalitiesCount1].Links = functionalities3.Links - r.ConnectedService.Functionalities[functionalitiesCount1].Name = functionalities3.Name - r.ConnectedService.Functionalities[functionalitiesCount1].Owner = functionalities3.Owner - r.ConnectedService.Functionalities[functionalitiesCount1].Slug = functionalities3.Slug - r.ConnectedService.Functionalities[functionalitiesCount1].UpdatedAt = functionalities3.UpdatedAt - r.ConnectedService.Functionalities[functionalitiesCount1].UpdatedBy = functionalities3.UpdatedBy - } - } - r.ConnectedService.ID = types.StringPointerValue(resp.ConnectedService.ID) - if len(resp.ConnectedService.Labels) > 0 { - r.ConnectedService.Labels = make(map[string]types.String) - for key3, value4 := range resp.ConnectedService.Labels { - r.ConnectedService.Labels[key3] = types.StringValue(value4) - } - } - if resp.ConnectedService.LastImport == nil { - r.ConnectedService.LastImport = nil - } else { - r.ConnectedService.LastImport = &tfTypes.ImportsImportableResourceEntity{} - r.ConnectedService.LastImport.ImportErrors = []tfTypes.ImportsImportErrorEntity{} - if len(r.ConnectedService.LastImport.ImportErrors) > len(resp.ConnectedService.LastImport.ImportErrors) { - r.ConnectedService.LastImport.ImportErrors = r.ConnectedService.LastImport.ImportErrors[:len(resp.ConnectedService.LastImport.ImportErrors)] - } - for importErrorsCount, importErrorsItem := range resp.ConnectedService.LastImport.ImportErrors { - var importErrors1 tfTypes.ImportsImportErrorEntity - if importErrorsItem.CreatedAt != nil { - importErrors1.CreatedAt = types.StringValue(importErrorsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - importErrors1.CreatedAt = types.StringNull() - } - if importErrorsItem.Data == nil { - importErrors1.Data = nil - } else { - importErrors1.Data = &tfTypes.TeamEntity1{} - } - importErrors1.ID = types.StringPointerValue(importErrorsItem.ID) - importErrors1.Message = types.StringPointerValue(importErrorsItem.Message) - if importErrorsItem.Resource == nil { - importErrors1.Resource = nil - } else { - importErrors1.Resource = &tfTypes.ImportsImportErrorEntityResourceEntity{} - importErrors1.Resource.Name = types.StringPointerValue(importErrorsItem.Resource.Name) - importErrors1.Resource.ResourceID = types.StringPointerValue(importErrorsItem.Resource.ResourceID) - importErrors1.Resource.ResourceType = types.StringPointerValue(importErrorsItem.Resource.ResourceType) - } - if importErrorsCount+1 > len(r.ConnectedService.LastImport.ImportErrors) { - r.ConnectedService.LastImport.ImportErrors = append(r.ConnectedService.LastImport.ImportErrors, importErrors1) - } else { - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].CreatedAt = importErrors1.CreatedAt - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].Data = importErrors1.Data - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].ID = importErrors1.ID - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].Message = importErrors1.Message - r.ConnectedService.LastImport.ImportErrors[importErrorsCount].Resource = importErrors1.Resource - } - } - if resp.ConnectedService.LastImport.ImportedAt != nil { - r.ConnectedService.LastImport.ImportedAt = types.StringValue(resp.ConnectedService.LastImport.ImportedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.LastImport.ImportedAt = types.StringNull() - } - r.ConnectedService.LastImport.RemoteID = types.StringPointerValue(resp.ConnectedService.LastImport.RemoteID) - if resp.ConnectedService.LastImport.State != nil { - r.ConnectedService.LastImport.State = types.StringValue(string(*resp.ConnectedService.LastImport.State)) - } else { - r.ConnectedService.LastImport.State = types.StringNull() - } - } - r.ConnectedService.Links = []tfTypes.LinksEntity{} - if len(r.ConnectedService.Links) > len(resp.ConnectedService.Links) { - r.ConnectedService.Links = r.ConnectedService.Links[:len(resp.ConnectedService.Links)] - } - for linksCount3, linksItem3 := range resp.ConnectedService.Links { - var links7 tfTypes.LinksEntity - links7.HrefURL = types.StringPointerValue(linksItem3.HrefURL) - links7.IconURL = types.StringPointerValue(linksItem3.IconURL) - links7.ID = types.StringPointerValue(linksItem3.ID) - links7.Name = types.StringPointerValue(linksItem3.Name) - if linksCount3+1 > len(r.ConnectedService.Links) { - r.ConnectedService.Links = append(r.ConnectedService.Links, links7) - } else { - r.ConnectedService.Links[linksCount3].HrefURL = links7.HrefURL - r.ConnectedService.Links[linksCount3].IconURL = links7.IconURL - r.ConnectedService.Links[linksCount3].ID = links7.ID - r.ConnectedService.Links[linksCount3].Name = links7.Name - } - } - r.ConnectedService.ManagedBy = types.StringPointerValue(resp.ConnectedService.ManagedBy) - if resp.ConnectedService.ManagedBySettings == nil { - r.ConnectedService.ManagedBySettings = nil - } else { - r.ConnectedService.ManagedBySettings = &tfTypes.TeamEntity1{} - } - r.ConnectedService.Name = types.StringPointerValue(resp.ConnectedService.Name) - if resp.ConnectedService.Owner == nil { - r.ConnectedService.Owner = nil - } else { - r.ConnectedService.Owner = &tfTypes.TeamEntity{} - if resp.ConnectedService.Owner.CreatedAt != nil { - r.ConnectedService.Owner.CreatedAt = types.StringValue(resp.ConnectedService.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.Owner.CreatedAt = types.StringNull() - } - if resp.ConnectedService.Owner.CreatedBy == nil { - r.ConnectedService.Owner.CreatedBy = nil - } else { - r.ConnectedService.Owner.CreatedBy = &tfTypes.AuthorEntity{} - r.ConnectedService.Owner.CreatedBy.Email = types.StringPointerValue(resp.ConnectedService.Owner.CreatedBy.Email) - r.ConnectedService.Owner.CreatedBy.ID = types.StringPointerValue(resp.ConnectedService.Owner.CreatedBy.ID) - r.ConnectedService.Owner.CreatedBy.Name = types.StringPointerValue(resp.ConnectedService.Owner.CreatedBy.Name) - r.ConnectedService.Owner.CreatedBy.Source = types.StringPointerValue(resp.ConnectedService.Owner.CreatedBy.Source) - } - r.ConnectedService.Owner.Description = types.StringPointerValue(resp.ConnectedService.Owner.Description) - r.ConnectedService.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.ConnectedService.Owner.Functionalities) > len(resp.ConnectedService.Owner.Functionalities) { - r.ConnectedService.Owner.Functionalities = r.ConnectedService.Owner.Functionalities[:len(resp.ConnectedService.Owner.Functionalities)] - } - for functionalitiesCount2, functionalitiesItem2 := range resp.ConnectedService.Owner.Functionalities { - var functionalities5 tfTypes.FunctionalityEntity - functionalities5.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem2.ActiveIncidents { - functionalities5.ActiveIncidents = append(functionalities5.ActiveIncidents, types.StringValue(v)) - } - functionalities5.AlertOnAdd = types.BoolPointerValue(functionalitiesItem2.AlertOnAdd) - functionalities5.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem2.AutoAddRespondingTeam) - if functionalitiesItem2.CreatedAt != nil { - functionalities5.CreatedAt = types.StringValue(functionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.CreatedAt = types.StringNull() - } - functionalities5.Description = types.StringPointerValue(functionalitiesItem2.Description) - functionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount4, externalResourcesItem4 := range functionalitiesItem2.ExternalResources { - var externalResources9 tfTypes.ExternalResourceEntity - externalResources9.ConnectionID = types.StringPointerValue(externalResourcesItem4.ConnectionID) - externalResources9.ConnectionName = types.StringPointerValue(externalResourcesItem4.ConnectionName) - externalResources9.ConnectionType = types.StringPointerValue(externalResourcesItem4.ConnectionType) - if externalResourcesItem4.CreatedAt != nil { - externalResources9.CreatedAt = types.StringValue(externalResourcesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.CreatedAt = types.StringNull() - } - externalResources9.Name = types.StringPointerValue(externalResourcesItem4.Name) - externalResources9.RemoteID = types.StringPointerValue(externalResourcesItem4.RemoteID) - externalResources9.RemoteURL = types.StringPointerValue(externalResourcesItem4.RemoteURL) - if externalResourcesItem4.UpdatedAt != nil { - externalResources9.UpdatedAt = types.StringValue(externalResourcesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.UpdatedAt = types.StringNull() - } - if externalResourcesCount4+1 > len(functionalities5.ExternalResources) { - functionalities5.ExternalResources = append(functionalities5.ExternalResources, externalResources9) - } else { - functionalities5.ExternalResources[externalResourcesCount4].ConnectionID = externalResources9.ConnectionID - functionalities5.ExternalResources[externalResourcesCount4].ConnectionName = externalResources9.ConnectionName - functionalities5.ExternalResources[externalResourcesCount4].ConnectionType = externalResources9.ConnectionType - functionalities5.ExternalResources[externalResourcesCount4].CreatedAt = externalResources9.CreatedAt - functionalities5.ExternalResources[externalResourcesCount4].Name = externalResources9.Name - functionalities5.ExternalResources[externalResourcesCount4].RemoteID = externalResources9.RemoteID - functionalities5.ExternalResources[externalResourcesCount4].RemoteURL = externalResources9.RemoteURL - functionalities5.ExternalResources[externalResourcesCount4].UpdatedAt = externalResources9.UpdatedAt - } - } - functionalities5.ID = types.StringPointerValue(functionalitiesItem2.ID) - if len(functionalitiesItem2.Labels) > 0 { - functionalities5.Labels = make(map[string]types.String) - for key4, value5 := range functionalitiesItem2.Labels { - functionalities5.Labels[key4] = types.StringValue(value5) - } - } - functionalities5.Links = []tfTypes.LinksEntity{} - for linksCount4, linksItem4 := range functionalitiesItem2.Links { - var links9 tfTypes.LinksEntity - links9.HrefURL = types.StringPointerValue(linksItem4.HrefURL) - links9.IconURL = types.StringPointerValue(linksItem4.IconURL) - links9.ID = types.StringPointerValue(linksItem4.ID) - links9.Name = types.StringPointerValue(linksItem4.Name) - if linksCount4+1 > len(functionalities5.Links) { - functionalities5.Links = append(functionalities5.Links, links9) - } else { - functionalities5.Links[linksCount4].HrefURL = links9.HrefURL - functionalities5.Links[linksCount4].IconURL = links9.IconURL - functionalities5.Links[linksCount4].ID = links9.ID - functionalities5.Links[linksCount4].Name = links9.Name - } - } - functionalities5.Name = types.StringPointerValue(functionalitiesItem2.Name) - if functionalitiesItem2.Owner == nil { - functionalities5.Owner = nil - } else { - functionalities5.Owner = &tfTypes.TeamEntity1{} - } - functionalities5.Slug = types.StringPointerValue(functionalitiesItem2.Slug) - if functionalitiesItem2.UpdatedAt != nil { - functionalities5.UpdatedAt = types.StringValue(functionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.UpdatedAt = types.StringNull() - } - if functionalitiesItem2.UpdatedBy == nil { - functionalities5.UpdatedBy = nil - } else { - functionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities5.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Email) - functionalities5.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem2.UpdatedBy.ID) - functionalities5.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Name) - functionalities5.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Source) - } - if functionalitiesCount2+1 > len(r.ConnectedService.Owner.Functionalities) { - r.ConnectedService.Owner.Functionalities = append(r.ConnectedService.Owner.Functionalities, functionalities5) - } else { - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].ActiveIncidents = functionalities5.ActiveIncidents - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].AlertOnAdd = functionalities5.AlertOnAdd - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].AutoAddRespondingTeam = functionalities5.AutoAddRespondingTeam - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].CreatedAt = functionalities5.CreatedAt - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Description = functionalities5.Description - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].ExternalResources = functionalities5.ExternalResources - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].ID = functionalities5.ID - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Labels = functionalities5.Labels - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Links = functionalities5.Links - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Name = functionalities5.Name - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Owner = functionalities5.Owner - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].Slug = functionalities5.Slug - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].UpdatedAt = functionalities5.UpdatedAt - r.ConnectedService.Owner.Functionalities[functionalitiesCount2].UpdatedBy = functionalities5.UpdatedBy - } - } - r.ConnectedService.Owner.ID = types.StringPointerValue(resp.ConnectedService.Owner.ID) - r.ConnectedService.Owner.Memberships = []tfTypes.MembershipEntity{} - if len(r.ConnectedService.Owner.Memberships) > len(resp.ConnectedService.Owner.Memberships) { - r.ConnectedService.Owner.Memberships = r.ConnectedService.Owner.Memberships[:len(resp.ConnectedService.Owner.Memberships)] - } - for membershipsCount1, membershipsItem1 := range resp.ConnectedService.Owner.Memberships { - var memberships3 tfTypes.MembershipEntity - if membershipsItem1.DefaultIncidentRole == nil { - memberships3.DefaultIncidentRole = nil - } else { - memberships3.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem1.DefaultIncidentRole.CreatedAt != nil { - memberships3.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Description) - if membershipsItem1.DefaultIncidentRole.DiscardedAt != nil { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.ID) - memberships3.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Name) - memberships3.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Summary) - if membershipsItem1.DefaultIncidentRole.UpdatedAt != nil { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem1.Schedule == nil { - memberships3.Schedule = nil - } else { - memberships3.Schedule = &tfTypes.ScheduleEntity{} - memberships3.Schedule.Discarded = types.BoolPointerValue(membershipsItem1.Schedule.Discarded) - memberships3.Schedule.ID = types.StringPointerValue(membershipsItem1.Schedule.ID) - memberships3.Schedule.Integration = types.StringPointerValue(membershipsItem1.Schedule.Integration) - memberships3.Schedule.Name = types.StringPointerValue(membershipsItem1.Schedule.Name) - } - if membershipsItem1.User == nil { - memberships3.User = nil - } else { - memberships3.User = &tfTypes.UserEntity{} - if membershipsItem1.User.CreatedAt != nil { - memberships3.User.CreatedAt = types.StringValue(membershipsItem1.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.CreatedAt = types.StringNull() - } - memberships3.User.Email = types.StringPointerValue(membershipsItem1.User.Email) - memberships3.User.ID = types.StringPointerValue(membershipsItem1.User.ID) - memberships3.User.Name = types.StringPointerValue(membershipsItem1.User.Name) - memberships3.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem1.User.SignalsEnabledNotificationTypes { - memberships3.User.SignalsEnabledNotificationTypes = append(memberships3.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships3.User.SlackLinked = types.BoolPointerValue(membershipsItem1.User.SlackLinked) - memberships3.User.SlackUserID = types.StringPointerValue(membershipsItem1.User.SlackUserID) - if membershipsItem1.User.UpdatedAt != nil { - memberships3.User.UpdatedAt = types.StringValue(membershipsItem1.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount1+1 > len(r.ConnectedService.Owner.Memberships) { - r.ConnectedService.Owner.Memberships = append(r.ConnectedService.Owner.Memberships, memberships3) - } else { - r.ConnectedService.Owner.Memberships[membershipsCount1].DefaultIncidentRole = memberships3.DefaultIncidentRole - r.ConnectedService.Owner.Memberships[membershipsCount1].Schedule = memberships3.Schedule - r.ConnectedService.Owner.Memberships[membershipsCount1].User = memberships3.User - } - } - if resp.ConnectedService.Owner.MsTeamsChannel == nil { - r.ConnectedService.Owner.MsTeamsChannel = nil - } else { - r.ConnectedService.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.ConnectedService.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.ChannelID) - r.ConnectedService.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.ChannelName) - r.ConnectedService.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.ChannelURL) - r.ConnectedService.Owner.MsTeamsChannel.ID = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.ID) - r.ConnectedService.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.MsTeamID) - r.ConnectedService.Owner.MsTeamsChannel.Status = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.Status) - r.ConnectedService.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(resp.ConnectedService.Owner.MsTeamsChannel.TeamName) - } - r.ConnectedService.Owner.Name = types.StringPointerValue(resp.ConnectedService.Owner.Name) - r.ConnectedService.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.ConnectedService.Owner.OwnedFunctionalities) > len(resp.ConnectedService.Owner.OwnedFunctionalities) { - r.ConnectedService.Owner.OwnedFunctionalities = r.ConnectedService.Owner.OwnedFunctionalities[:len(resp.ConnectedService.Owner.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount1, ownedFunctionalitiesItem1 := range resp.ConnectedService.Owner.OwnedFunctionalities { - var ownedFunctionalities3 tfTypes.FunctionalityEntity - ownedFunctionalities3.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem1.ActiveIncidents { - ownedFunctionalities3.ActiveIncidents = append(ownedFunctionalities3.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities3.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem1.AlertOnAdd) - ownedFunctionalities3.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem1.AutoAddRespondingTeam) - if ownedFunctionalitiesItem1.CreatedAt != nil { - ownedFunctionalities3.CreatedAt = types.StringValue(ownedFunctionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.CreatedAt = types.StringNull() - } - ownedFunctionalities3.Description = types.StringPointerValue(ownedFunctionalitiesItem1.Description) - ownedFunctionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount5, externalResourcesItem5 := range ownedFunctionalitiesItem1.ExternalResources { - var externalResources11 tfTypes.ExternalResourceEntity - externalResources11.ConnectionID = types.StringPointerValue(externalResourcesItem5.ConnectionID) - externalResources11.ConnectionName = types.StringPointerValue(externalResourcesItem5.ConnectionName) - externalResources11.ConnectionType = types.StringPointerValue(externalResourcesItem5.ConnectionType) - if externalResourcesItem5.CreatedAt != nil { - externalResources11.CreatedAt = types.StringValue(externalResourcesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.CreatedAt = types.StringNull() - } - externalResources11.Name = types.StringPointerValue(externalResourcesItem5.Name) - externalResources11.RemoteID = types.StringPointerValue(externalResourcesItem5.RemoteID) - externalResources11.RemoteURL = types.StringPointerValue(externalResourcesItem5.RemoteURL) - if externalResourcesItem5.UpdatedAt != nil { - externalResources11.UpdatedAt = types.StringValue(externalResourcesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.UpdatedAt = types.StringNull() - } - if externalResourcesCount5+1 > len(ownedFunctionalities3.ExternalResources) { - ownedFunctionalities3.ExternalResources = append(ownedFunctionalities3.ExternalResources, externalResources11) - } else { - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionID = externalResources11.ConnectionID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionName = externalResources11.ConnectionName - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionType = externalResources11.ConnectionType - ownedFunctionalities3.ExternalResources[externalResourcesCount5].CreatedAt = externalResources11.CreatedAt - ownedFunctionalities3.ExternalResources[externalResourcesCount5].Name = externalResources11.Name - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteID = externalResources11.RemoteID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteURL = externalResources11.RemoteURL - ownedFunctionalities3.ExternalResources[externalResourcesCount5].UpdatedAt = externalResources11.UpdatedAt - } - } - ownedFunctionalities3.ID = types.StringPointerValue(ownedFunctionalitiesItem1.ID) - if len(ownedFunctionalitiesItem1.Labels) > 0 { - ownedFunctionalities3.Labels = make(map[string]types.String) - for key5, value6 := range ownedFunctionalitiesItem1.Labels { - ownedFunctionalities3.Labels[key5] = types.StringValue(value6) - } - } - ownedFunctionalities3.Links = []tfTypes.LinksEntity{} - for linksCount5, linksItem5 := range ownedFunctionalitiesItem1.Links { - var links11 tfTypes.LinksEntity - links11.HrefURL = types.StringPointerValue(linksItem5.HrefURL) - links11.IconURL = types.StringPointerValue(linksItem5.IconURL) - links11.ID = types.StringPointerValue(linksItem5.ID) - links11.Name = types.StringPointerValue(linksItem5.Name) - if linksCount5+1 > len(ownedFunctionalities3.Links) { - ownedFunctionalities3.Links = append(ownedFunctionalities3.Links, links11) - } else { - ownedFunctionalities3.Links[linksCount5].HrefURL = links11.HrefURL - ownedFunctionalities3.Links[linksCount5].IconURL = links11.IconURL - ownedFunctionalities3.Links[linksCount5].ID = links11.ID - ownedFunctionalities3.Links[linksCount5].Name = links11.Name - } - } - ownedFunctionalities3.Name = types.StringPointerValue(ownedFunctionalitiesItem1.Name) - if ownedFunctionalitiesItem1.Owner == nil { - ownedFunctionalities3.Owner = nil - } else { - ownedFunctionalities3.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities3.Slug = types.StringPointerValue(ownedFunctionalitiesItem1.Slug) - if ownedFunctionalitiesItem1.UpdatedAt != nil { - ownedFunctionalities3.UpdatedAt = types.StringValue(ownedFunctionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem1.UpdatedBy == nil { - ownedFunctionalities3.UpdatedBy = nil - } else { - ownedFunctionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities3.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Email) - ownedFunctionalities3.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.ID) - ownedFunctionalities3.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Name) - ownedFunctionalities3.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Source) - } - if ownedFunctionalitiesCount1+1 > len(r.ConnectedService.Owner.OwnedFunctionalities) { - r.ConnectedService.Owner.OwnedFunctionalities = append(r.ConnectedService.Owner.OwnedFunctionalities, ownedFunctionalities3) - } else { - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ActiveIncidents = ownedFunctionalities3.ActiveIncidents - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AlertOnAdd = ownedFunctionalities3.AlertOnAdd - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AutoAddRespondingTeam = ownedFunctionalities3.AutoAddRespondingTeam - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].CreatedAt = ownedFunctionalities3.CreatedAt - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Description = ownedFunctionalities3.Description - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ExternalResources = ownedFunctionalities3.ExternalResources - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ID = ownedFunctionalities3.ID - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Labels = ownedFunctionalities3.Labels - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Links = ownedFunctionalities3.Links - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Name = ownedFunctionalities3.Name - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Owner = ownedFunctionalities3.Owner - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Slug = ownedFunctionalities3.Slug - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedAt = ownedFunctionalities3.UpdatedAt - r.ConnectedService.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedBy = ownedFunctionalities3.UpdatedBy - } - } - r.ConnectedService.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.ConnectedService.Owner.OwnedRunbooks) > len(resp.ConnectedService.Owner.OwnedRunbooks) { - r.ConnectedService.Owner.OwnedRunbooks = r.ConnectedService.Owner.OwnedRunbooks[:len(resp.ConnectedService.Owner.OwnedRunbooks)] - } - for ownedRunbooksCount1, ownedRunbooksItem1 := range resp.ConnectedService.Owner.OwnedRunbooks { - var ownedRunbooks3 tfTypes.SlimRunbookEntity - if ownedRunbooksItem1.AttachmentRule == nil { - ownedRunbooks3.AttachmentRule = nil - } else { - ownedRunbooks3.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem1.AttachmentRule.Logic == nil { - ownedRunbooks3.AttachmentRule.Logic = nil - } else { - ownedRunbooks3.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem1.AttachmentRule.UserData == nil { - ownedRunbooks3.AttachmentRule.UserData = nil - } else { - ownedRunbooks3.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks3.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Label) - ownedRunbooks3.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Type) - ownedRunbooks3.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Value) - } - } - ownedRunbooks3.Categories = types.StringPointerValue(ownedRunbooksItem1.Categories) - if ownedRunbooksItem1.CreatedAt != nil { - ownedRunbooks3.CreatedAt = types.StringValue(ownedRunbooksItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.CreatedAt = types.StringNull() - } - ownedRunbooks3.Description = types.StringPointerValue(ownedRunbooksItem1.Description) - ownedRunbooks3.ID = types.StringPointerValue(ownedRunbooksItem1.ID) - ownedRunbooks3.Name = types.StringPointerValue(ownedRunbooksItem1.Name) - if ownedRunbooksItem1.Owner == nil { - ownedRunbooks3.Owner = nil - } else { - ownedRunbooks3.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks3.Summary = types.StringPointerValue(ownedRunbooksItem1.Summary) - ownedRunbooks3.Type = types.StringPointerValue(ownedRunbooksItem1.Type) - if ownedRunbooksItem1.UpdatedAt != nil { - ownedRunbooks3.UpdatedAt = types.StringValue(ownedRunbooksItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount1+1 > len(r.ConnectedService.Owner.OwnedRunbooks) { - r.ConnectedService.Owner.OwnedRunbooks = append(r.ConnectedService.Owner.OwnedRunbooks, ownedRunbooks3) - } else { - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].AttachmentRule = ownedRunbooks3.AttachmentRule - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Categories = ownedRunbooks3.Categories - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].CreatedAt = ownedRunbooks3.CreatedAt - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Description = ownedRunbooks3.Description - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].ID = ownedRunbooks3.ID - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Name = ownedRunbooks3.Name - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Owner = ownedRunbooks3.Owner - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Summary = ownedRunbooks3.Summary - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].Type = ownedRunbooks3.Type - r.ConnectedService.Owner.OwnedRunbooks[ownedRunbooksCount1].UpdatedAt = ownedRunbooks3.UpdatedAt - } - } - r.ConnectedService.Owner.SignalsIcalURL = types.StringPointerValue(resp.ConnectedService.Owner.SignalsIcalURL) - if resp.ConnectedService.Owner.SlackChannel == nil { - r.ConnectedService.Owner.SlackChannel = nil - } else { - r.ConnectedService.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.ConnectedService.Owner.SlackChannel.ID = types.StringPointerValue(resp.ConnectedService.Owner.SlackChannel.ID) - r.ConnectedService.Owner.SlackChannel.Name = types.StringPointerValue(resp.ConnectedService.Owner.SlackChannel.Name) - r.ConnectedService.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(resp.ConnectedService.Owner.SlackChannel.SlackChannelID) - } - r.ConnectedService.Owner.Slug = types.StringPointerValue(resp.ConnectedService.Owner.Slug) - if resp.ConnectedService.Owner.UpdatedAt != nil { - r.ConnectedService.Owner.UpdatedAt = types.StringValue(resp.ConnectedService.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.Owner.UpdatedAt = types.StringNull() - } - } - if resp.ConnectedService.ServiceChecklistUpdatedAt != nil { - r.ConnectedService.ServiceChecklistUpdatedAt = types.StringValue(resp.ConnectedService.ServiceChecklistUpdatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.ServiceChecklistUpdatedAt = types.StringNull() - } - if resp.ConnectedService.ServiceTier != nil { - r.ConnectedService.ServiceTier = types.Int64Value(int64(*resp.ConnectedService.ServiceTier)) - } else { - r.ConnectedService.ServiceTier = types.Int64Null() - } - r.ConnectedService.Slug = types.StringPointerValue(resp.ConnectedService.Slug) - r.ConnectedService.Teams = []tfTypes.TeamEntity{} - if len(r.ConnectedService.Teams) > len(resp.ConnectedService.Teams) { - r.ConnectedService.Teams = r.ConnectedService.Teams[:len(resp.ConnectedService.Teams)] - } - for teamsCount, teamsItem := range resp.ConnectedService.Teams { - var teams1 tfTypes.TeamEntity - if teamsItem.CreatedAt != nil { - teams1.CreatedAt = types.StringValue(teamsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams1.CreatedAt = types.StringNull() - } - if teamsItem.CreatedBy == nil { - teams1.CreatedBy = nil - } else { - teams1.CreatedBy = &tfTypes.AuthorEntity{} - teams1.CreatedBy.Email = types.StringPointerValue(teamsItem.CreatedBy.Email) - teams1.CreatedBy.ID = types.StringPointerValue(teamsItem.CreatedBy.ID) - teams1.CreatedBy.Name = types.StringPointerValue(teamsItem.CreatedBy.Name) - teams1.CreatedBy.Source = types.StringPointerValue(teamsItem.CreatedBy.Source) - } - teams1.Description = types.StringPointerValue(teamsItem.Description) - teams1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount3, functionalitiesItem3 := range teamsItem.Functionalities { - var functionalities7 tfTypes.FunctionalityEntity - functionalities7.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem3.ActiveIncidents { - functionalities7.ActiveIncidents = append(functionalities7.ActiveIncidents, types.StringValue(v)) - } - functionalities7.AlertOnAdd = types.BoolPointerValue(functionalitiesItem3.AlertOnAdd) - functionalities7.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem3.AutoAddRespondingTeam) - if functionalitiesItem3.CreatedAt != nil { - functionalities7.CreatedAt = types.StringValue(functionalitiesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.CreatedAt = types.StringNull() - } - functionalities7.Description = types.StringPointerValue(functionalitiesItem3.Description) - functionalities7.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount6, externalResourcesItem6 := range functionalitiesItem3.ExternalResources { - var externalResources13 tfTypes.ExternalResourceEntity - externalResources13.ConnectionID = types.StringPointerValue(externalResourcesItem6.ConnectionID) - externalResources13.ConnectionName = types.StringPointerValue(externalResourcesItem6.ConnectionName) - externalResources13.ConnectionType = types.StringPointerValue(externalResourcesItem6.ConnectionType) - if externalResourcesItem6.CreatedAt != nil { - externalResources13.CreatedAt = types.StringValue(externalResourcesItem6.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.CreatedAt = types.StringNull() - } - externalResources13.Name = types.StringPointerValue(externalResourcesItem6.Name) - externalResources13.RemoteID = types.StringPointerValue(externalResourcesItem6.RemoteID) - externalResources13.RemoteURL = types.StringPointerValue(externalResourcesItem6.RemoteURL) - if externalResourcesItem6.UpdatedAt != nil { - externalResources13.UpdatedAt = types.StringValue(externalResourcesItem6.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.UpdatedAt = types.StringNull() - } - if externalResourcesCount6+1 > len(functionalities7.ExternalResources) { - functionalities7.ExternalResources = append(functionalities7.ExternalResources, externalResources13) - } else { - functionalities7.ExternalResources[externalResourcesCount6].ConnectionID = externalResources13.ConnectionID - functionalities7.ExternalResources[externalResourcesCount6].ConnectionName = externalResources13.ConnectionName - functionalities7.ExternalResources[externalResourcesCount6].ConnectionType = externalResources13.ConnectionType - functionalities7.ExternalResources[externalResourcesCount6].CreatedAt = externalResources13.CreatedAt - functionalities7.ExternalResources[externalResourcesCount6].Name = externalResources13.Name - functionalities7.ExternalResources[externalResourcesCount6].RemoteID = externalResources13.RemoteID - functionalities7.ExternalResources[externalResourcesCount6].RemoteURL = externalResources13.RemoteURL - functionalities7.ExternalResources[externalResourcesCount6].UpdatedAt = externalResources13.UpdatedAt - } - } - functionalities7.ID = types.StringPointerValue(functionalitiesItem3.ID) - if len(functionalitiesItem3.Labels) > 0 { - functionalities7.Labels = make(map[string]types.String) - for key6, value8 := range functionalitiesItem3.Labels { - functionalities7.Labels[key6] = types.StringValue(value8) - } - } - functionalities7.Links = []tfTypes.LinksEntity{} - for linksCount6, linksItem6 := range functionalitiesItem3.Links { - var links13 tfTypes.LinksEntity - links13.HrefURL = types.StringPointerValue(linksItem6.HrefURL) - links13.IconURL = types.StringPointerValue(linksItem6.IconURL) - links13.ID = types.StringPointerValue(linksItem6.ID) - links13.Name = types.StringPointerValue(linksItem6.Name) - if linksCount6+1 > len(functionalities7.Links) { - functionalities7.Links = append(functionalities7.Links, links13) - } else { - functionalities7.Links[linksCount6].HrefURL = links13.HrefURL - functionalities7.Links[linksCount6].IconURL = links13.IconURL - functionalities7.Links[linksCount6].ID = links13.ID - functionalities7.Links[linksCount6].Name = links13.Name - } - } - functionalities7.Name = types.StringPointerValue(functionalitiesItem3.Name) - if functionalitiesItem3.Owner == nil { - functionalities7.Owner = nil - } else { - functionalities7.Owner = &tfTypes.TeamEntity1{} - } - functionalities7.Slug = types.StringPointerValue(functionalitiesItem3.Slug) - if functionalitiesItem3.UpdatedAt != nil { - functionalities7.UpdatedAt = types.StringValue(functionalitiesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.UpdatedAt = types.StringNull() - } - if functionalitiesItem3.UpdatedBy == nil { - functionalities7.UpdatedBy = nil - } else { - functionalities7.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities7.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Email) - functionalities7.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem3.UpdatedBy.ID) - functionalities7.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Name) - functionalities7.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Source) - } - if functionalitiesCount3+1 > len(teams1.Functionalities) { - teams1.Functionalities = append(teams1.Functionalities, functionalities7) - } else { - teams1.Functionalities[functionalitiesCount3].ActiveIncidents = functionalities7.ActiveIncidents - teams1.Functionalities[functionalitiesCount3].AlertOnAdd = functionalities7.AlertOnAdd - teams1.Functionalities[functionalitiesCount3].AutoAddRespondingTeam = functionalities7.AutoAddRespondingTeam - teams1.Functionalities[functionalitiesCount3].CreatedAt = functionalities7.CreatedAt - teams1.Functionalities[functionalitiesCount3].Description = functionalities7.Description - teams1.Functionalities[functionalitiesCount3].ExternalResources = functionalities7.ExternalResources - teams1.Functionalities[functionalitiesCount3].ID = functionalities7.ID - teams1.Functionalities[functionalitiesCount3].Labels = functionalities7.Labels - teams1.Functionalities[functionalitiesCount3].Links = functionalities7.Links - teams1.Functionalities[functionalitiesCount3].Name = functionalities7.Name - teams1.Functionalities[functionalitiesCount3].Owner = functionalities7.Owner - teams1.Functionalities[functionalitiesCount3].Slug = functionalities7.Slug - teams1.Functionalities[functionalitiesCount3].UpdatedAt = functionalities7.UpdatedAt - teams1.Functionalities[functionalitiesCount3].UpdatedBy = functionalities7.UpdatedBy - } - } - teams1.ID = types.StringPointerValue(teamsItem.ID) - teams1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount2, membershipsItem2 := range teamsItem.Memberships { - var memberships5 tfTypes.MembershipEntity - if membershipsItem2.DefaultIncidentRole == nil { - memberships5.DefaultIncidentRole = nil - } else { - memberships5.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem2.DefaultIncidentRole.CreatedAt != nil { - memberships5.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Description) - if membershipsItem2.DefaultIncidentRole.DiscardedAt != nil { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.ID) - memberships5.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Name) - memberships5.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Summary) - if membershipsItem2.DefaultIncidentRole.UpdatedAt != nil { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem2.Schedule == nil { - memberships5.Schedule = nil - } else { - memberships5.Schedule = &tfTypes.ScheduleEntity{} - memberships5.Schedule.Discarded = types.BoolPointerValue(membershipsItem2.Schedule.Discarded) - memberships5.Schedule.ID = types.StringPointerValue(membershipsItem2.Schedule.ID) - memberships5.Schedule.Integration = types.StringPointerValue(membershipsItem2.Schedule.Integration) - memberships5.Schedule.Name = types.StringPointerValue(membershipsItem2.Schedule.Name) - } - if membershipsItem2.User == nil { - memberships5.User = nil - } else { - memberships5.User = &tfTypes.UserEntity{} - if membershipsItem2.User.CreatedAt != nil { - memberships5.User.CreatedAt = types.StringValue(membershipsItem2.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.CreatedAt = types.StringNull() - } - memberships5.User.Email = types.StringPointerValue(membershipsItem2.User.Email) - memberships5.User.ID = types.StringPointerValue(membershipsItem2.User.ID) - memberships5.User.Name = types.StringPointerValue(membershipsItem2.User.Name) - memberships5.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem2.User.SignalsEnabledNotificationTypes { - memberships5.User.SignalsEnabledNotificationTypes = append(memberships5.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships5.User.SlackLinked = types.BoolPointerValue(membershipsItem2.User.SlackLinked) - memberships5.User.SlackUserID = types.StringPointerValue(membershipsItem2.User.SlackUserID) - if membershipsItem2.User.UpdatedAt != nil { - memberships5.User.UpdatedAt = types.StringValue(membershipsItem2.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount2+1 > len(teams1.Memberships) { - teams1.Memberships = append(teams1.Memberships, memberships5) - } else { - teams1.Memberships[membershipsCount2].DefaultIncidentRole = memberships5.DefaultIncidentRole - teams1.Memberships[membershipsCount2].Schedule = memberships5.Schedule - teams1.Memberships[membershipsCount2].User = memberships5.User - } - } - if teamsItem.MsTeamsChannel == nil { - teams1.MsTeamsChannel = nil - } else { - teams1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams1.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelID) - teams1.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelName) - teams1.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelURL) - teams1.MsTeamsChannel.ID = types.StringPointerValue(teamsItem.MsTeamsChannel.ID) - teams1.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem.MsTeamsChannel.MsTeamID) - teams1.MsTeamsChannel.Status = types.StringPointerValue(teamsItem.MsTeamsChannel.Status) - teams1.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem.MsTeamsChannel.TeamName) - } - teams1.Name = types.StringPointerValue(teamsItem.Name) - teams1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount2, ownedFunctionalitiesItem2 := range teamsItem.OwnedFunctionalities { - var ownedFunctionalities5 tfTypes.FunctionalityEntity - ownedFunctionalities5.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem2.ActiveIncidents { - ownedFunctionalities5.ActiveIncidents = append(ownedFunctionalities5.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities5.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem2.AlertOnAdd) - ownedFunctionalities5.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem2.AutoAddRespondingTeam) - if ownedFunctionalitiesItem2.CreatedAt != nil { - ownedFunctionalities5.CreatedAt = types.StringValue(ownedFunctionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.CreatedAt = types.StringNull() - } - ownedFunctionalities5.Description = types.StringPointerValue(ownedFunctionalitiesItem2.Description) - ownedFunctionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount7, externalResourcesItem7 := range ownedFunctionalitiesItem2.ExternalResources { - var externalResources15 tfTypes.ExternalResourceEntity - externalResources15.ConnectionID = types.StringPointerValue(externalResourcesItem7.ConnectionID) - externalResources15.ConnectionName = types.StringPointerValue(externalResourcesItem7.ConnectionName) - externalResources15.ConnectionType = types.StringPointerValue(externalResourcesItem7.ConnectionType) - if externalResourcesItem7.CreatedAt != nil { - externalResources15.CreatedAt = types.StringValue(externalResourcesItem7.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.CreatedAt = types.StringNull() - } - externalResources15.Name = types.StringPointerValue(externalResourcesItem7.Name) - externalResources15.RemoteID = types.StringPointerValue(externalResourcesItem7.RemoteID) - externalResources15.RemoteURL = types.StringPointerValue(externalResourcesItem7.RemoteURL) - if externalResourcesItem7.UpdatedAt != nil { - externalResources15.UpdatedAt = types.StringValue(externalResourcesItem7.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.UpdatedAt = types.StringNull() - } - if externalResourcesCount7+1 > len(ownedFunctionalities5.ExternalResources) { - ownedFunctionalities5.ExternalResources = append(ownedFunctionalities5.ExternalResources, externalResources15) - } else { - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionID = externalResources15.ConnectionID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionName = externalResources15.ConnectionName - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionType = externalResources15.ConnectionType - ownedFunctionalities5.ExternalResources[externalResourcesCount7].CreatedAt = externalResources15.CreatedAt - ownedFunctionalities5.ExternalResources[externalResourcesCount7].Name = externalResources15.Name - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteID = externalResources15.RemoteID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteURL = externalResources15.RemoteURL - ownedFunctionalities5.ExternalResources[externalResourcesCount7].UpdatedAt = externalResources15.UpdatedAt - } - } - ownedFunctionalities5.ID = types.StringPointerValue(ownedFunctionalitiesItem2.ID) - if len(ownedFunctionalitiesItem2.Labels) > 0 { - ownedFunctionalities5.Labels = make(map[string]types.String) - for key7, value9 := range ownedFunctionalitiesItem2.Labels { - ownedFunctionalities5.Labels[key7] = types.StringValue(value9) - } - } - ownedFunctionalities5.Links = []tfTypes.LinksEntity{} - for linksCount7, linksItem7 := range ownedFunctionalitiesItem2.Links { - var links15 tfTypes.LinksEntity - links15.HrefURL = types.StringPointerValue(linksItem7.HrefURL) - links15.IconURL = types.StringPointerValue(linksItem7.IconURL) - links15.ID = types.StringPointerValue(linksItem7.ID) - links15.Name = types.StringPointerValue(linksItem7.Name) - if linksCount7+1 > len(ownedFunctionalities5.Links) { - ownedFunctionalities5.Links = append(ownedFunctionalities5.Links, links15) - } else { - ownedFunctionalities5.Links[linksCount7].HrefURL = links15.HrefURL - ownedFunctionalities5.Links[linksCount7].IconURL = links15.IconURL - ownedFunctionalities5.Links[linksCount7].ID = links15.ID - ownedFunctionalities5.Links[linksCount7].Name = links15.Name - } - } - ownedFunctionalities5.Name = types.StringPointerValue(ownedFunctionalitiesItem2.Name) - if ownedFunctionalitiesItem2.Owner == nil { - ownedFunctionalities5.Owner = nil - } else { - ownedFunctionalities5.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities5.Slug = types.StringPointerValue(ownedFunctionalitiesItem2.Slug) - if ownedFunctionalitiesItem2.UpdatedAt != nil { - ownedFunctionalities5.UpdatedAt = types.StringValue(ownedFunctionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem2.UpdatedBy == nil { - ownedFunctionalities5.UpdatedBy = nil - } else { - ownedFunctionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities5.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Email) - ownedFunctionalities5.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.ID) - ownedFunctionalities5.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Name) - ownedFunctionalities5.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Source) - } - if ownedFunctionalitiesCount2+1 > len(teams1.OwnedFunctionalities) { - teams1.OwnedFunctionalities = append(teams1.OwnedFunctionalities, ownedFunctionalities5) - } else { - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ActiveIncidents = ownedFunctionalities5.ActiveIncidents - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AlertOnAdd = ownedFunctionalities5.AlertOnAdd - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AutoAddRespondingTeam = ownedFunctionalities5.AutoAddRespondingTeam - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].CreatedAt = ownedFunctionalities5.CreatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Description = ownedFunctionalities5.Description - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ExternalResources = ownedFunctionalities5.ExternalResources - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ID = ownedFunctionalities5.ID - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Labels = ownedFunctionalities5.Labels - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Links = ownedFunctionalities5.Links - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Name = ownedFunctionalities5.Name - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Owner = ownedFunctionalities5.Owner - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Slug = ownedFunctionalities5.Slug - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedAt = ownedFunctionalities5.UpdatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedBy = ownedFunctionalities5.UpdatedBy - } - } - teams1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount2, ownedRunbooksItem2 := range teamsItem.OwnedRunbooks { - var ownedRunbooks5 tfTypes.SlimRunbookEntity - if ownedRunbooksItem2.AttachmentRule == nil { - ownedRunbooks5.AttachmentRule = nil - } else { - ownedRunbooks5.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem2.AttachmentRule.Logic == nil { - ownedRunbooks5.AttachmentRule.Logic = nil - } else { - ownedRunbooks5.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem2.AttachmentRule.UserData == nil { - ownedRunbooks5.AttachmentRule.UserData = nil - } else { - ownedRunbooks5.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks5.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Label) - ownedRunbooks5.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Type) - ownedRunbooks5.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Value) - } - } - ownedRunbooks5.Categories = types.StringPointerValue(ownedRunbooksItem2.Categories) - if ownedRunbooksItem2.CreatedAt != nil { - ownedRunbooks5.CreatedAt = types.StringValue(ownedRunbooksItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.CreatedAt = types.StringNull() - } - ownedRunbooks5.Description = types.StringPointerValue(ownedRunbooksItem2.Description) - ownedRunbooks5.ID = types.StringPointerValue(ownedRunbooksItem2.ID) - ownedRunbooks5.Name = types.StringPointerValue(ownedRunbooksItem2.Name) - if ownedRunbooksItem2.Owner == nil { - ownedRunbooks5.Owner = nil - } else { - ownedRunbooks5.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks5.Summary = types.StringPointerValue(ownedRunbooksItem2.Summary) - ownedRunbooks5.Type = types.StringPointerValue(ownedRunbooksItem2.Type) - if ownedRunbooksItem2.UpdatedAt != nil { - ownedRunbooks5.UpdatedAt = types.StringValue(ownedRunbooksItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount2+1 > len(teams1.OwnedRunbooks) { - teams1.OwnedRunbooks = append(teams1.OwnedRunbooks, ownedRunbooks5) - } else { - teams1.OwnedRunbooks[ownedRunbooksCount2].AttachmentRule = ownedRunbooks5.AttachmentRule - teams1.OwnedRunbooks[ownedRunbooksCount2].Categories = ownedRunbooks5.Categories - teams1.OwnedRunbooks[ownedRunbooksCount2].CreatedAt = ownedRunbooks5.CreatedAt - teams1.OwnedRunbooks[ownedRunbooksCount2].Description = ownedRunbooks5.Description - teams1.OwnedRunbooks[ownedRunbooksCount2].ID = ownedRunbooks5.ID - teams1.OwnedRunbooks[ownedRunbooksCount2].Name = ownedRunbooks5.Name - teams1.OwnedRunbooks[ownedRunbooksCount2].Owner = ownedRunbooks5.Owner - teams1.OwnedRunbooks[ownedRunbooksCount2].Summary = ownedRunbooks5.Summary - teams1.OwnedRunbooks[ownedRunbooksCount2].Type = ownedRunbooks5.Type - teams1.OwnedRunbooks[ownedRunbooksCount2].UpdatedAt = ownedRunbooks5.UpdatedAt - } - } - teams1.SignalsIcalURL = types.StringPointerValue(teamsItem.SignalsIcalURL) - if teamsItem.SlackChannel == nil { - teams1.SlackChannel = nil - } else { - teams1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams1.SlackChannel.ID = types.StringPointerValue(teamsItem.SlackChannel.ID) - teams1.SlackChannel.Name = types.StringPointerValue(teamsItem.SlackChannel.Name) - teams1.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem.SlackChannel.SlackChannelID) - } - teams1.Slug = types.StringPointerValue(teamsItem.Slug) - if teamsItem.UpdatedAt != nil { - teams1.UpdatedAt = types.StringValue(teamsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams1.UpdatedAt = types.StringNull() - } - if teamsCount+1 > len(r.ConnectedService.Teams) { - r.ConnectedService.Teams = append(r.ConnectedService.Teams, teams1) - } else { - r.ConnectedService.Teams[teamsCount].CreatedAt = teams1.CreatedAt - r.ConnectedService.Teams[teamsCount].CreatedBy = teams1.CreatedBy - r.ConnectedService.Teams[teamsCount].Description = teams1.Description - r.ConnectedService.Teams[teamsCount].Functionalities = teams1.Functionalities - r.ConnectedService.Teams[teamsCount].ID = teams1.ID - r.ConnectedService.Teams[teamsCount].Memberships = teams1.Memberships - r.ConnectedService.Teams[teamsCount].MsTeamsChannel = teams1.MsTeamsChannel - r.ConnectedService.Teams[teamsCount].Name = teams1.Name - r.ConnectedService.Teams[teamsCount].OwnedFunctionalities = teams1.OwnedFunctionalities - r.ConnectedService.Teams[teamsCount].OwnedRunbooks = teams1.OwnedRunbooks - r.ConnectedService.Teams[teamsCount].SignalsIcalURL = teams1.SignalsIcalURL - r.ConnectedService.Teams[teamsCount].SlackChannel = teams1.SlackChannel - r.ConnectedService.Teams[teamsCount].Slug = teams1.Slug - r.ConnectedService.Teams[teamsCount].UpdatedAt = teams1.UpdatedAt - } - } - if resp.ConnectedService.UpdatedAt != nil { - r.ConnectedService.UpdatedAt = types.StringValue(resp.ConnectedService.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.ConnectedService.UpdatedAt = types.StringNull() - } - if resp.ConnectedService.UpdatedBy == nil { - r.ConnectedService.UpdatedBy = nil - } else { - r.ConnectedService.UpdatedBy = &tfTypes.AuthorEntity{} - r.ConnectedService.UpdatedBy.Email = types.StringPointerValue(resp.ConnectedService.UpdatedBy.Email) - r.ConnectedService.UpdatedBy.ID = types.StringPointerValue(resp.ConnectedService.UpdatedBy.ID) - r.ConnectedService.UpdatedBy.Name = types.StringPointerValue(resp.ConnectedService.UpdatedBy.Name) - r.ConnectedService.UpdatedBy.Source = types.StringPointerValue(resp.ConnectedService.UpdatedBy.Source) - } - } - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.ID = types.StringPointerValue(resp.ID) - r.Notes = types.StringPointerValue(resp.Notes) - if resp.Service == nil { - r.Service = nil - } else { - r.Service = &tfTypes.ServiceEntity{} - r.Service.ActiveIncidents = []types.String{} - for _, v := range resp.Service.ActiveIncidents { - r.Service.ActiveIncidents = append(r.Service.ActiveIncidents, types.StringValue(v)) - } - r.Service.AlertOnAdd = types.BoolPointerValue(resp.Service.AlertOnAdd) - r.Service.AllowedParams = []types.String{} - for _, v := range resp.Service.AllowedParams { - r.Service.AllowedParams = append(r.Service.AllowedParams, types.StringValue(v)) - } - r.Service.AutoAddRespondingTeam = types.BoolPointerValue(resp.Service.AutoAddRespondingTeam) - r.Service.Checklists = []tfTypes.Checklists{} - if len(r.Service.Checklists) > len(resp.Service.Checklists) { - r.Service.Checklists = r.Service.Checklists[:len(resp.Service.Checklists)] - } - for checklistsCount1, checklistsItem1 := range resp.Service.Checklists { - var checklists3 tfTypes.Checklists - checklists3.Checks = []tfTypes.ChecklistCheckEntity{} - for checksCount1, checksItem1 := range checklistsItem1.Checks { - var checks3 tfTypes.ChecklistCheckEntity - checks3.Description = types.StringPointerValue(checksItem1.Description) - checks3.ID = types.StringPointerValue(checksItem1.ID) - checks3.Name = types.StringPointerValue(checksItem1.Name) - checks3.Status = types.BoolPointerValue(checksItem1.Status) - if checksCount1+1 > len(checklists3.Checks) { - checklists3.Checks = append(checklists3.Checks, checks3) - } else { - checklists3.Checks[checksCount1].Description = checks3.Description - checklists3.Checks[checksCount1].ID = checks3.ID - checklists3.Checks[checksCount1].Name = checks3.Name - checklists3.Checks[checksCount1].Status = checks3.Status - } - } - checklists3.CreatedAt = types.StringPointerValue(checklistsItem1.CreatedAt) - checklists3.Description = types.StringPointerValue(checklistsItem1.Description) - checklists3.ID = types.StringPointerValue(checklistsItem1.ID) - checklists3.Name = types.StringPointerValue(checklistsItem1.Name) - if checklistsItem1.Owner == nil { - checklists3.Owner = nil - } else { - checklists3.Owner = &tfTypes.TeamEntity{} - if checklistsItem1.Owner.CreatedAt != nil { - checklists3.Owner.CreatedAt = types.StringValue(checklistsItem1.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - checklists3.Owner.CreatedAt = types.StringNull() - } - if checklistsItem1.Owner.CreatedBy == nil { - checklists3.Owner.CreatedBy = nil - } else { - checklists3.Owner.CreatedBy = &tfTypes.AuthorEntity{} - checklists3.Owner.CreatedBy.Email = types.StringPointerValue(checklistsItem1.Owner.CreatedBy.Email) - checklists3.Owner.CreatedBy.ID = types.StringPointerValue(checklistsItem1.Owner.CreatedBy.ID) - checklists3.Owner.CreatedBy.Name = types.StringPointerValue(checklistsItem1.Owner.CreatedBy.Name) - checklists3.Owner.CreatedBy.Source = types.StringPointerValue(checklistsItem1.Owner.CreatedBy.Source) - } - checklists3.Owner.Description = types.StringPointerValue(checklistsItem1.Owner.Description) - checklists3.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount4, functionalitiesItem4 := range checklistsItem1.Owner.Functionalities { - var functionalities9 tfTypes.FunctionalityEntity - functionalities9.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem4.ActiveIncidents { - functionalities9.ActiveIncidents = append(functionalities9.ActiveIncidents, types.StringValue(v)) - } - functionalities9.AlertOnAdd = types.BoolPointerValue(functionalitiesItem4.AlertOnAdd) - functionalities9.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem4.AutoAddRespondingTeam) - if functionalitiesItem4.CreatedAt != nil { - functionalities9.CreatedAt = types.StringValue(functionalitiesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities9.CreatedAt = types.StringNull() - } - functionalities9.Description = types.StringPointerValue(functionalitiesItem4.Description) - functionalities9.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount8, externalResourcesItem8 := range functionalitiesItem4.ExternalResources { - var externalResources17 tfTypes.ExternalResourceEntity - externalResources17.ConnectionID = types.StringPointerValue(externalResourcesItem8.ConnectionID) - externalResources17.ConnectionName = types.StringPointerValue(externalResourcesItem8.ConnectionName) - externalResources17.ConnectionType = types.StringPointerValue(externalResourcesItem8.ConnectionType) - if externalResourcesItem8.CreatedAt != nil { - externalResources17.CreatedAt = types.StringValue(externalResourcesItem8.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources17.CreatedAt = types.StringNull() - } - externalResources17.Name = types.StringPointerValue(externalResourcesItem8.Name) - externalResources17.RemoteID = types.StringPointerValue(externalResourcesItem8.RemoteID) - externalResources17.RemoteURL = types.StringPointerValue(externalResourcesItem8.RemoteURL) - if externalResourcesItem8.UpdatedAt != nil { - externalResources17.UpdatedAt = types.StringValue(externalResourcesItem8.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources17.UpdatedAt = types.StringNull() - } - if externalResourcesCount8+1 > len(functionalities9.ExternalResources) { - functionalities9.ExternalResources = append(functionalities9.ExternalResources, externalResources17) - } else { - functionalities9.ExternalResources[externalResourcesCount8].ConnectionID = externalResources17.ConnectionID - functionalities9.ExternalResources[externalResourcesCount8].ConnectionName = externalResources17.ConnectionName - functionalities9.ExternalResources[externalResourcesCount8].ConnectionType = externalResources17.ConnectionType - functionalities9.ExternalResources[externalResourcesCount8].CreatedAt = externalResources17.CreatedAt - functionalities9.ExternalResources[externalResourcesCount8].Name = externalResources17.Name - functionalities9.ExternalResources[externalResourcesCount8].RemoteID = externalResources17.RemoteID - functionalities9.ExternalResources[externalResourcesCount8].RemoteURL = externalResources17.RemoteURL - functionalities9.ExternalResources[externalResourcesCount8].UpdatedAt = externalResources17.UpdatedAt - } - } - functionalities9.ID = types.StringPointerValue(functionalitiesItem4.ID) - if len(functionalitiesItem4.Labels) > 0 { - functionalities9.Labels = make(map[string]types.String) - for key8, value11 := range functionalitiesItem4.Labels { - functionalities9.Labels[key8] = types.StringValue(value11) - } - } - functionalities9.Links = []tfTypes.LinksEntity{} - for linksCount8, linksItem8 := range functionalitiesItem4.Links { - var links17 tfTypes.LinksEntity - links17.HrefURL = types.StringPointerValue(linksItem8.HrefURL) - links17.IconURL = types.StringPointerValue(linksItem8.IconURL) - links17.ID = types.StringPointerValue(linksItem8.ID) - links17.Name = types.StringPointerValue(linksItem8.Name) - if linksCount8+1 > len(functionalities9.Links) { - functionalities9.Links = append(functionalities9.Links, links17) - } else { - functionalities9.Links[linksCount8].HrefURL = links17.HrefURL - functionalities9.Links[linksCount8].IconURL = links17.IconURL - functionalities9.Links[linksCount8].ID = links17.ID - functionalities9.Links[linksCount8].Name = links17.Name - } - } - functionalities9.Name = types.StringPointerValue(functionalitiesItem4.Name) - if functionalitiesItem4.Owner == nil { - functionalities9.Owner = nil - } else { - functionalities9.Owner = &tfTypes.TeamEntity1{} - } - functionalities9.Slug = types.StringPointerValue(functionalitiesItem4.Slug) - if functionalitiesItem4.UpdatedAt != nil { - functionalities9.UpdatedAt = types.StringValue(functionalitiesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities9.UpdatedAt = types.StringNull() - } - if functionalitiesItem4.UpdatedBy == nil { - functionalities9.UpdatedBy = nil - } else { - functionalities9.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities9.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem4.UpdatedBy.Email) - functionalities9.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem4.UpdatedBy.ID) - functionalities9.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem4.UpdatedBy.Name) - functionalities9.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem4.UpdatedBy.Source) - } - if functionalitiesCount4+1 > len(checklists3.Owner.Functionalities) { - checklists3.Owner.Functionalities = append(checklists3.Owner.Functionalities, functionalities9) - } else { - checklists3.Owner.Functionalities[functionalitiesCount4].ActiveIncidents = functionalities9.ActiveIncidents - checklists3.Owner.Functionalities[functionalitiesCount4].AlertOnAdd = functionalities9.AlertOnAdd - checklists3.Owner.Functionalities[functionalitiesCount4].AutoAddRespondingTeam = functionalities9.AutoAddRespondingTeam - checklists3.Owner.Functionalities[functionalitiesCount4].CreatedAt = functionalities9.CreatedAt - checklists3.Owner.Functionalities[functionalitiesCount4].Description = functionalities9.Description - checklists3.Owner.Functionalities[functionalitiesCount4].ExternalResources = functionalities9.ExternalResources - checklists3.Owner.Functionalities[functionalitiesCount4].ID = functionalities9.ID - checklists3.Owner.Functionalities[functionalitiesCount4].Labels = functionalities9.Labels - checklists3.Owner.Functionalities[functionalitiesCount4].Links = functionalities9.Links - checklists3.Owner.Functionalities[functionalitiesCount4].Name = functionalities9.Name - checklists3.Owner.Functionalities[functionalitiesCount4].Owner = functionalities9.Owner - checklists3.Owner.Functionalities[functionalitiesCount4].Slug = functionalities9.Slug - checklists3.Owner.Functionalities[functionalitiesCount4].UpdatedAt = functionalities9.UpdatedAt - checklists3.Owner.Functionalities[functionalitiesCount4].UpdatedBy = functionalities9.UpdatedBy - } - } - checklists3.Owner.ID = types.StringPointerValue(checklistsItem1.Owner.ID) - checklists3.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount3, membershipsItem3 := range checklistsItem1.Owner.Memberships { - var memberships7 tfTypes.MembershipEntity - if membershipsItem3.DefaultIncidentRole == nil { - memberships7.DefaultIncidentRole = nil - } else { - memberships7.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem3.DefaultIncidentRole.CreatedAt != nil { - memberships7.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem3.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships7.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships7.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem3.DefaultIncidentRole.Description) - if membershipsItem3.DefaultIncidentRole.DiscardedAt != nil { - memberships7.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem3.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships7.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships7.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem3.DefaultIncidentRole.ID) - memberships7.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem3.DefaultIncidentRole.Name) - memberships7.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem3.DefaultIncidentRole.Summary) - if membershipsItem3.DefaultIncidentRole.UpdatedAt != nil { - memberships7.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem3.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships7.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem3.Schedule == nil { - memberships7.Schedule = nil - } else { - memberships7.Schedule = &tfTypes.ScheduleEntity{} - memberships7.Schedule.Discarded = types.BoolPointerValue(membershipsItem3.Schedule.Discarded) - memberships7.Schedule.ID = types.StringPointerValue(membershipsItem3.Schedule.ID) - memberships7.Schedule.Integration = types.StringPointerValue(membershipsItem3.Schedule.Integration) - memberships7.Schedule.Name = types.StringPointerValue(membershipsItem3.Schedule.Name) - } - if membershipsItem3.User == nil { - memberships7.User = nil - } else { - memberships7.User = &tfTypes.UserEntity{} - if membershipsItem3.User.CreatedAt != nil { - memberships7.User.CreatedAt = types.StringValue(membershipsItem3.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships7.User.CreatedAt = types.StringNull() - } - memberships7.User.Email = types.StringPointerValue(membershipsItem3.User.Email) - memberships7.User.ID = types.StringPointerValue(membershipsItem3.User.ID) - memberships7.User.Name = types.StringPointerValue(membershipsItem3.User.Name) - memberships7.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem3.User.SignalsEnabledNotificationTypes { - memberships7.User.SignalsEnabledNotificationTypes = append(memberships7.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships7.User.SlackLinked = types.BoolPointerValue(membershipsItem3.User.SlackLinked) - memberships7.User.SlackUserID = types.StringPointerValue(membershipsItem3.User.SlackUserID) - if membershipsItem3.User.UpdatedAt != nil { - memberships7.User.UpdatedAt = types.StringValue(membershipsItem3.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships7.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount3+1 > len(checklists3.Owner.Memberships) { - checklists3.Owner.Memberships = append(checklists3.Owner.Memberships, memberships7) - } else { - checklists3.Owner.Memberships[membershipsCount3].DefaultIncidentRole = memberships7.DefaultIncidentRole - checklists3.Owner.Memberships[membershipsCount3].Schedule = memberships7.Schedule - checklists3.Owner.Memberships[membershipsCount3].User = memberships7.User - } - } - if checklistsItem1.Owner.MsTeamsChannel == nil { - checklists3.Owner.MsTeamsChannel = nil - } else { - checklists3.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - checklists3.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.ChannelID) - checklists3.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.ChannelName) - checklists3.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.ChannelURL) - checklists3.Owner.MsTeamsChannel.ID = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.ID) - checklists3.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.MsTeamID) - checklists3.Owner.MsTeamsChannel.Status = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.Status) - checklists3.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(checklistsItem1.Owner.MsTeamsChannel.TeamName) - } - checklists3.Owner.Name = types.StringPointerValue(checklistsItem1.Owner.Name) - checklists3.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount3, ownedFunctionalitiesItem3 := range checklistsItem1.Owner.OwnedFunctionalities { - var ownedFunctionalities7 tfTypes.FunctionalityEntity - ownedFunctionalities7.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem3.ActiveIncidents { - ownedFunctionalities7.ActiveIncidents = append(ownedFunctionalities7.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities7.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem3.AlertOnAdd) - ownedFunctionalities7.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem3.AutoAddRespondingTeam) - if ownedFunctionalitiesItem3.CreatedAt != nil { - ownedFunctionalities7.CreatedAt = types.StringValue(ownedFunctionalitiesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities7.CreatedAt = types.StringNull() - } - ownedFunctionalities7.Description = types.StringPointerValue(ownedFunctionalitiesItem3.Description) - ownedFunctionalities7.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount9, externalResourcesItem9 := range ownedFunctionalitiesItem3.ExternalResources { - var externalResources19 tfTypes.ExternalResourceEntity - externalResources19.ConnectionID = types.StringPointerValue(externalResourcesItem9.ConnectionID) - externalResources19.ConnectionName = types.StringPointerValue(externalResourcesItem9.ConnectionName) - externalResources19.ConnectionType = types.StringPointerValue(externalResourcesItem9.ConnectionType) - if externalResourcesItem9.CreatedAt != nil { - externalResources19.CreatedAt = types.StringValue(externalResourcesItem9.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources19.CreatedAt = types.StringNull() - } - externalResources19.Name = types.StringPointerValue(externalResourcesItem9.Name) - externalResources19.RemoteID = types.StringPointerValue(externalResourcesItem9.RemoteID) - externalResources19.RemoteURL = types.StringPointerValue(externalResourcesItem9.RemoteURL) - if externalResourcesItem9.UpdatedAt != nil { - externalResources19.UpdatedAt = types.StringValue(externalResourcesItem9.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources19.UpdatedAt = types.StringNull() - } - if externalResourcesCount9+1 > len(ownedFunctionalities7.ExternalResources) { - ownedFunctionalities7.ExternalResources = append(ownedFunctionalities7.ExternalResources, externalResources19) - } else { - ownedFunctionalities7.ExternalResources[externalResourcesCount9].ConnectionID = externalResources19.ConnectionID - ownedFunctionalities7.ExternalResources[externalResourcesCount9].ConnectionName = externalResources19.ConnectionName - ownedFunctionalities7.ExternalResources[externalResourcesCount9].ConnectionType = externalResources19.ConnectionType - ownedFunctionalities7.ExternalResources[externalResourcesCount9].CreatedAt = externalResources19.CreatedAt - ownedFunctionalities7.ExternalResources[externalResourcesCount9].Name = externalResources19.Name - ownedFunctionalities7.ExternalResources[externalResourcesCount9].RemoteID = externalResources19.RemoteID - ownedFunctionalities7.ExternalResources[externalResourcesCount9].RemoteURL = externalResources19.RemoteURL - ownedFunctionalities7.ExternalResources[externalResourcesCount9].UpdatedAt = externalResources19.UpdatedAt - } - } - ownedFunctionalities7.ID = types.StringPointerValue(ownedFunctionalitiesItem3.ID) - if len(ownedFunctionalitiesItem3.Labels) > 0 { - ownedFunctionalities7.Labels = make(map[string]types.String) - for key9, value12 := range ownedFunctionalitiesItem3.Labels { - ownedFunctionalities7.Labels[key9] = types.StringValue(value12) - } - } - ownedFunctionalities7.Links = []tfTypes.LinksEntity{} - for linksCount9, linksItem9 := range ownedFunctionalitiesItem3.Links { - var links19 tfTypes.LinksEntity - links19.HrefURL = types.StringPointerValue(linksItem9.HrefURL) - links19.IconURL = types.StringPointerValue(linksItem9.IconURL) - links19.ID = types.StringPointerValue(linksItem9.ID) - links19.Name = types.StringPointerValue(linksItem9.Name) - if linksCount9+1 > len(ownedFunctionalities7.Links) { - ownedFunctionalities7.Links = append(ownedFunctionalities7.Links, links19) - } else { - ownedFunctionalities7.Links[linksCount9].HrefURL = links19.HrefURL - ownedFunctionalities7.Links[linksCount9].IconURL = links19.IconURL - ownedFunctionalities7.Links[linksCount9].ID = links19.ID - ownedFunctionalities7.Links[linksCount9].Name = links19.Name - } - } - ownedFunctionalities7.Name = types.StringPointerValue(ownedFunctionalitiesItem3.Name) - if ownedFunctionalitiesItem3.Owner == nil { - ownedFunctionalities7.Owner = nil - } else { - ownedFunctionalities7.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities7.Slug = types.StringPointerValue(ownedFunctionalitiesItem3.Slug) - if ownedFunctionalitiesItem3.UpdatedAt != nil { - ownedFunctionalities7.UpdatedAt = types.StringValue(ownedFunctionalitiesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities7.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem3.UpdatedBy == nil { - ownedFunctionalities7.UpdatedBy = nil - } else { - ownedFunctionalities7.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities7.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem3.UpdatedBy.Email) - ownedFunctionalities7.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem3.UpdatedBy.ID) - ownedFunctionalities7.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem3.UpdatedBy.Name) - ownedFunctionalities7.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem3.UpdatedBy.Source) - } - if ownedFunctionalitiesCount3+1 > len(checklists3.Owner.OwnedFunctionalities) { - checklists3.Owner.OwnedFunctionalities = append(checklists3.Owner.OwnedFunctionalities, ownedFunctionalities7) - } else { - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].ActiveIncidents = ownedFunctionalities7.ActiveIncidents - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].AlertOnAdd = ownedFunctionalities7.AlertOnAdd - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].AutoAddRespondingTeam = ownedFunctionalities7.AutoAddRespondingTeam - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].CreatedAt = ownedFunctionalities7.CreatedAt - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Description = ownedFunctionalities7.Description - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].ExternalResources = ownedFunctionalities7.ExternalResources - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].ID = ownedFunctionalities7.ID - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Labels = ownedFunctionalities7.Labels - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Links = ownedFunctionalities7.Links - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Name = ownedFunctionalities7.Name - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Owner = ownedFunctionalities7.Owner - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].Slug = ownedFunctionalities7.Slug - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].UpdatedAt = ownedFunctionalities7.UpdatedAt - checklists3.Owner.OwnedFunctionalities[ownedFunctionalitiesCount3].UpdatedBy = ownedFunctionalities7.UpdatedBy - } - } - checklists3.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount3, ownedRunbooksItem3 := range checklistsItem1.Owner.OwnedRunbooks { - var ownedRunbooks7 tfTypes.SlimRunbookEntity - if ownedRunbooksItem3.AttachmentRule == nil { - ownedRunbooks7.AttachmentRule = nil - } else { - ownedRunbooks7.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem3.AttachmentRule.Logic == nil { - ownedRunbooks7.AttachmentRule.Logic = nil - } else { - ownedRunbooks7.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem3.AttachmentRule.UserData == nil { - ownedRunbooks7.AttachmentRule.UserData = nil - } else { - ownedRunbooks7.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks7.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem3.AttachmentRule.UserData.Label) - ownedRunbooks7.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem3.AttachmentRule.UserData.Type) - ownedRunbooks7.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem3.AttachmentRule.UserData.Value) - } - } - ownedRunbooks7.Categories = types.StringPointerValue(ownedRunbooksItem3.Categories) - if ownedRunbooksItem3.CreatedAt != nil { - ownedRunbooks7.CreatedAt = types.StringValue(ownedRunbooksItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks7.CreatedAt = types.StringNull() - } - ownedRunbooks7.Description = types.StringPointerValue(ownedRunbooksItem3.Description) - ownedRunbooks7.ID = types.StringPointerValue(ownedRunbooksItem3.ID) - ownedRunbooks7.Name = types.StringPointerValue(ownedRunbooksItem3.Name) - if ownedRunbooksItem3.Owner == nil { - ownedRunbooks7.Owner = nil - } else { - ownedRunbooks7.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks7.Summary = types.StringPointerValue(ownedRunbooksItem3.Summary) - ownedRunbooks7.Type = types.StringPointerValue(ownedRunbooksItem3.Type) - if ownedRunbooksItem3.UpdatedAt != nil { - ownedRunbooks7.UpdatedAt = types.StringValue(ownedRunbooksItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks7.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount3+1 > len(checklists3.Owner.OwnedRunbooks) { - checklists3.Owner.OwnedRunbooks = append(checklists3.Owner.OwnedRunbooks, ownedRunbooks7) - } else { - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].AttachmentRule = ownedRunbooks7.AttachmentRule - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Categories = ownedRunbooks7.Categories - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].CreatedAt = ownedRunbooks7.CreatedAt - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Description = ownedRunbooks7.Description - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].ID = ownedRunbooks7.ID - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Name = ownedRunbooks7.Name - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Owner = ownedRunbooks7.Owner - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Summary = ownedRunbooks7.Summary - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].Type = ownedRunbooks7.Type - checklists3.Owner.OwnedRunbooks[ownedRunbooksCount3].UpdatedAt = ownedRunbooks7.UpdatedAt - } - } - checklists3.Owner.SignalsIcalURL = types.StringPointerValue(checklistsItem1.Owner.SignalsIcalURL) - if checklistsItem1.Owner.SlackChannel == nil { - checklists3.Owner.SlackChannel = nil - } else { - checklists3.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - checklists3.Owner.SlackChannel.ID = types.StringPointerValue(checklistsItem1.Owner.SlackChannel.ID) - checklists3.Owner.SlackChannel.Name = types.StringPointerValue(checklistsItem1.Owner.SlackChannel.Name) - checklists3.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(checklistsItem1.Owner.SlackChannel.SlackChannelID) - } - checklists3.Owner.Slug = types.StringPointerValue(checklistsItem1.Owner.Slug) - if checklistsItem1.Owner.UpdatedAt != nil { - checklists3.Owner.UpdatedAt = types.StringValue(checklistsItem1.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists3.Owner.UpdatedAt = types.StringNull() - } - } - if checklistsItem1.UpdatedAt != nil { - checklists3.UpdatedAt = types.StringValue(checklistsItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists3.UpdatedAt = types.StringNull() - } - if checklistsCount1+1 > len(r.Service.Checklists) { - r.Service.Checklists = append(r.Service.Checklists, checklists3) - } else { - r.Service.Checklists[checklistsCount1].Checks = checklists3.Checks - r.Service.Checklists[checklistsCount1].CreatedAt = checklists3.CreatedAt - r.Service.Checklists[checklistsCount1].Description = checklists3.Description - r.Service.Checklists[checklistsCount1].ID = checklists3.ID - r.Service.Checklists[checklistsCount1].Name = checklists3.Name - r.Service.Checklists[checklistsCount1].Owner = checklists3.Owner - r.Service.Checklists[checklistsCount1].UpdatedAt = checklists3.UpdatedAt - } - } - if resp.Service.CompletedChecks != nil { - r.Service.CompletedChecks = types.Int64Value(int64(*resp.Service.CompletedChecks)) - } else { - r.Service.CompletedChecks = types.Int64Null() - } - if resp.Service.CreatedAt != nil { - r.Service.CreatedAt = types.StringValue(resp.Service.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.CreatedAt = types.StringNull() - } - r.Service.Description = types.StringPointerValue(resp.Service.Description) - r.Service.ExternalResources = []tfTypes.ExternalResourceEntity{} - if len(r.Service.ExternalResources) > len(resp.Service.ExternalResources) { - r.Service.ExternalResources = r.Service.ExternalResources[:len(resp.Service.ExternalResources)] - } - for externalResourcesCount10, externalResourcesItem10 := range resp.Service.ExternalResources { - var externalResources21 tfTypes.ExternalResourceEntity - externalResources21.ConnectionID = types.StringPointerValue(externalResourcesItem10.ConnectionID) - externalResources21.ConnectionName = types.StringPointerValue(externalResourcesItem10.ConnectionName) - externalResources21.ConnectionType = types.StringPointerValue(externalResourcesItem10.ConnectionType) - if externalResourcesItem10.CreatedAt != nil { - externalResources21.CreatedAt = types.StringValue(externalResourcesItem10.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources21.CreatedAt = types.StringNull() - } - externalResources21.Name = types.StringPointerValue(externalResourcesItem10.Name) - externalResources21.RemoteID = types.StringPointerValue(externalResourcesItem10.RemoteID) - externalResources21.RemoteURL = types.StringPointerValue(externalResourcesItem10.RemoteURL) - if externalResourcesItem10.UpdatedAt != nil { - externalResources21.UpdatedAt = types.StringValue(externalResourcesItem10.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources21.UpdatedAt = types.StringNull() - } - if externalResourcesCount10+1 > len(r.Service.ExternalResources) { - r.Service.ExternalResources = append(r.Service.ExternalResources, externalResources21) - } else { - r.Service.ExternalResources[externalResourcesCount10].ConnectionID = externalResources21.ConnectionID - r.Service.ExternalResources[externalResourcesCount10].ConnectionName = externalResources21.ConnectionName - r.Service.ExternalResources[externalResourcesCount10].ConnectionType = externalResources21.ConnectionType - r.Service.ExternalResources[externalResourcesCount10].CreatedAt = externalResources21.CreatedAt - r.Service.ExternalResources[externalResourcesCount10].Name = externalResources21.Name - r.Service.ExternalResources[externalResourcesCount10].RemoteID = externalResources21.RemoteID - r.Service.ExternalResources[externalResourcesCount10].RemoteURL = externalResources21.RemoteURL - r.Service.ExternalResources[externalResourcesCount10].UpdatedAt = externalResources21.UpdatedAt - } - } - r.Service.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Service.Functionalities) > len(resp.Service.Functionalities) { - r.Service.Functionalities = r.Service.Functionalities[:len(resp.Service.Functionalities)] - } - for functionalitiesCount5, functionalitiesItem5 := range resp.Service.Functionalities { - var functionalities11 tfTypes.FunctionalityEntity - functionalities11.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem5.ActiveIncidents { - functionalities11.ActiveIncidents = append(functionalities11.ActiveIncidents, types.StringValue(v)) - } - functionalities11.AlertOnAdd = types.BoolPointerValue(functionalitiesItem5.AlertOnAdd) - functionalities11.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem5.AutoAddRespondingTeam) - if functionalitiesItem5.CreatedAt != nil { - functionalities11.CreatedAt = types.StringValue(functionalitiesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities11.CreatedAt = types.StringNull() - } - functionalities11.Description = types.StringPointerValue(functionalitiesItem5.Description) - functionalities11.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount11, externalResourcesItem11 := range functionalitiesItem5.ExternalResources { - var externalResources23 tfTypes.ExternalResourceEntity - externalResources23.ConnectionID = types.StringPointerValue(externalResourcesItem11.ConnectionID) - externalResources23.ConnectionName = types.StringPointerValue(externalResourcesItem11.ConnectionName) - externalResources23.ConnectionType = types.StringPointerValue(externalResourcesItem11.ConnectionType) - if externalResourcesItem11.CreatedAt != nil { - externalResources23.CreatedAt = types.StringValue(externalResourcesItem11.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources23.CreatedAt = types.StringNull() - } - externalResources23.Name = types.StringPointerValue(externalResourcesItem11.Name) - externalResources23.RemoteID = types.StringPointerValue(externalResourcesItem11.RemoteID) - externalResources23.RemoteURL = types.StringPointerValue(externalResourcesItem11.RemoteURL) - if externalResourcesItem11.UpdatedAt != nil { - externalResources23.UpdatedAt = types.StringValue(externalResourcesItem11.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources23.UpdatedAt = types.StringNull() - } - if externalResourcesCount11+1 > len(functionalities11.ExternalResources) { - functionalities11.ExternalResources = append(functionalities11.ExternalResources, externalResources23) - } else { - functionalities11.ExternalResources[externalResourcesCount11].ConnectionID = externalResources23.ConnectionID - functionalities11.ExternalResources[externalResourcesCount11].ConnectionName = externalResources23.ConnectionName - functionalities11.ExternalResources[externalResourcesCount11].ConnectionType = externalResources23.ConnectionType - functionalities11.ExternalResources[externalResourcesCount11].CreatedAt = externalResources23.CreatedAt - functionalities11.ExternalResources[externalResourcesCount11].Name = externalResources23.Name - functionalities11.ExternalResources[externalResourcesCount11].RemoteID = externalResources23.RemoteID - functionalities11.ExternalResources[externalResourcesCount11].RemoteURL = externalResources23.RemoteURL - functionalities11.ExternalResources[externalResourcesCount11].UpdatedAt = externalResources23.UpdatedAt - } - } - functionalities11.ID = types.StringPointerValue(functionalitiesItem5.ID) - if len(functionalitiesItem5.Labels) > 0 { - functionalities11.Labels = make(map[string]types.String) - for key10, value14 := range functionalitiesItem5.Labels { - functionalities11.Labels[key10] = types.StringValue(value14) - } - } - functionalities11.Links = []tfTypes.LinksEntity{} - for linksCount10, linksItem10 := range functionalitiesItem5.Links { - var links21 tfTypes.LinksEntity - links21.HrefURL = types.StringPointerValue(linksItem10.HrefURL) - links21.IconURL = types.StringPointerValue(linksItem10.IconURL) - links21.ID = types.StringPointerValue(linksItem10.ID) - links21.Name = types.StringPointerValue(linksItem10.Name) - if linksCount10+1 > len(functionalities11.Links) { - functionalities11.Links = append(functionalities11.Links, links21) - } else { - functionalities11.Links[linksCount10].HrefURL = links21.HrefURL - functionalities11.Links[linksCount10].IconURL = links21.IconURL - functionalities11.Links[linksCount10].ID = links21.ID - functionalities11.Links[linksCount10].Name = links21.Name - } - } - functionalities11.Name = types.StringPointerValue(functionalitiesItem5.Name) - if functionalitiesItem5.Owner == nil { - functionalities11.Owner = nil - } else { - functionalities11.Owner = &tfTypes.TeamEntity1{} - } - functionalities11.Slug = types.StringPointerValue(functionalitiesItem5.Slug) - if functionalitiesItem5.UpdatedAt != nil { - functionalities11.UpdatedAt = types.StringValue(functionalitiesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities11.UpdatedAt = types.StringNull() - } - if functionalitiesItem5.UpdatedBy == nil { - functionalities11.UpdatedBy = nil - } else { - functionalities11.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities11.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem5.UpdatedBy.Email) - functionalities11.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem5.UpdatedBy.ID) - functionalities11.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem5.UpdatedBy.Name) - functionalities11.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem5.UpdatedBy.Source) - } - if functionalitiesCount5+1 > len(r.Service.Functionalities) { - r.Service.Functionalities = append(r.Service.Functionalities, functionalities11) - } else { - r.Service.Functionalities[functionalitiesCount5].ActiveIncidents = functionalities11.ActiveIncidents - r.Service.Functionalities[functionalitiesCount5].AlertOnAdd = functionalities11.AlertOnAdd - r.Service.Functionalities[functionalitiesCount5].AutoAddRespondingTeam = functionalities11.AutoAddRespondingTeam - r.Service.Functionalities[functionalitiesCount5].CreatedAt = functionalities11.CreatedAt - r.Service.Functionalities[functionalitiesCount5].Description = functionalities11.Description - r.Service.Functionalities[functionalitiesCount5].ExternalResources = functionalities11.ExternalResources - r.Service.Functionalities[functionalitiesCount5].ID = functionalities11.ID - r.Service.Functionalities[functionalitiesCount5].Labels = functionalities11.Labels - r.Service.Functionalities[functionalitiesCount5].Links = functionalities11.Links - r.Service.Functionalities[functionalitiesCount5].Name = functionalities11.Name - r.Service.Functionalities[functionalitiesCount5].Owner = functionalities11.Owner - r.Service.Functionalities[functionalitiesCount5].Slug = functionalities11.Slug - r.Service.Functionalities[functionalitiesCount5].UpdatedAt = functionalities11.UpdatedAt - r.Service.Functionalities[functionalitiesCount5].UpdatedBy = functionalities11.UpdatedBy - } - } - r.Service.ID = types.StringPointerValue(resp.Service.ID) - if len(resp.Service.Labels) > 0 { - r.Service.Labels = make(map[string]types.String) - for key11, value15 := range resp.Service.Labels { - r.Service.Labels[key11] = types.StringValue(value15) - } - } - if resp.Service.LastImport == nil { - r.Service.LastImport = nil - } else { - r.Service.LastImport = &tfTypes.ImportsImportableResourceEntity{} - r.Service.LastImport.ImportErrors = []tfTypes.ImportsImportErrorEntity{} - if len(r.Service.LastImport.ImportErrors) > len(resp.Service.LastImport.ImportErrors) { - r.Service.LastImport.ImportErrors = r.Service.LastImport.ImportErrors[:len(resp.Service.LastImport.ImportErrors)] - } - for importErrorsCount1, importErrorsItem1 := range resp.Service.LastImport.ImportErrors { - var importErrors3 tfTypes.ImportsImportErrorEntity - if importErrorsItem1.CreatedAt != nil { - importErrors3.CreatedAt = types.StringValue(importErrorsItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - importErrors3.CreatedAt = types.StringNull() - } - if importErrorsItem1.Data == nil { - importErrors3.Data = nil - } else { - importErrors3.Data = &tfTypes.TeamEntity1{} - } - importErrors3.ID = types.StringPointerValue(importErrorsItem1.ID) - importErrors3.Message = types.StringPointerValue(importErrorsItem1.Message) - if importErrorsItem1.Resource == nil { - importErrors3.Resource = nil - } else { - importErrors3.Resource = &tfTypes.ImportsImportErrorEntityResourceEntity{} - importErrors3.Resource.Name = types.StringPointerValue(importErrorsItem1.Resource.Name) - importErrors3.Resource.ResourceID = types.StringPointerValue(importErrorsItem1.Resource.ResourceID) - importErrors3.Resource.ResourceType = types.StringPointerValue(importErrorsItem1.Resource.ResourceType) - } - if importErrorsCount1+1 > len(r.Service.LastImport.ImportErrors) { - r.Service.LastImport.ImportErrors = append(r.Service.LastImport.ImportErrors, importErrors3) - } else { - r.Service.LastImport.ImportErrors[importErrorsCount1].CreatedAt = importErrors3.CreatedAt - r.Service.LastImport.ImportErrors[importErrorsCount1].Data = importErrors3.Data - r.Service.LastImport.ImportErrors[importErrorsCount1].ID = importErrors3.ID - r.Service.LastImport.ImportErrors[importErrorsCount1].Message = importErrors3.Message - r.Service.LastImport.ImportErrors[importErrorsCount1].Resource = importErrors3.Resource - } - } - if resp.Service.LastImport.ImportedAt != nil { - r.Service.LastImport.ImportedAt = types.StringValue(resp.Service.LastImport.ImportedAt.Format(time.RFC3339Nano)) - } else { - r.Service.LastImport.ImportedAt = types.StringNull() - } - r.Service.LastImport.RemoteID = types.StringPointerValue(resp.Service.LastImport.RemoteID) - if resp.Service.LastImport.State != nil { - r.Service.LastImport.State = types.StringValue(string(*resp.Service.LastImport.State)) - } else { - r.Service.LastImport.State = types.StringNull() - } - } - r.Service.Links = []tfTypes.LinksEntity{} - if len(r.Service.Links) > len(resp.Service.Links) { - r.Service.Links = r.Service.Links[:len(resp.Service.Links)] - } - for linksCount11, linksItem11 := range resp.Service.Links { - var links23 tfTypes.LinksEntity - links23.HrefURL = types.StringPointerValue(linksItem11.HrefURL) - links23.IconURL = types.StringPointerValue(linksItem11.IconURL) - links23.ID = types.StringPointerValue(linksItem11.ID) - links23.Name = types.StringPointerValue(linksItem11.Name) - if linksCount11+1 > len(r.Service.Links) { - r.Service.Links = append(r.Service.Links, links23) - } else { - r.Service.Links[linksCount11].HrefURL = links23.HrefURL - r.Service.Links[linksCount11].IconURL = links23.IconURL - r.Service.Links[linksCount11].ID = links23.ID - r.Service.Links[linksCount11].Name = links23.Name - } - } - r.Service.ManagedBy = types.StringPointerValue(resp.Service.ManagedBy) - if resp.Service.ManagedBySettings == nil { - r.Service.ManagedBySettings = nil - } else { - r.Service.ManagedBySettings = &tfTypes.TeamEntity1{} - } - r.Service.Name = types.StringPointerValue(resp.Service.Name) - if resp.Service.Owner == nil { - r.Service.Owner = nil - } else { - r.Service.Owner = &tfTypes.TeamEntity{} - if resp.Service.Owner.CreatedAt != nil { - r.Service.Owner.CreatedAt = types.StringValue(resp.Service.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.Owner.CreatedAt = types.StringNull() - } - if resp.Service.Owner.CreatedBy == nil { - r.Service.Owner.CreatedBy = nil - } else { - r.Service.Owner.CreatedBy = &tfTypes.AuthorEntity{} - r.Service.Owner.CreatedBy.Email = types.StringPointerValue(resp.Service.Owner.CreatedBy.Email) - r.Service.Owner.CreatedBy.ID = types.StringPointerValue(resp.Service.Owner.CreatedBy.ID) - r.Service.Owner.CreatedBy.Name = types.StringPointerValue(resp.Service.Owner.CreatedBy.Name) - r.Service.Owner.CreatedBy.Source = types.StringPointerValue(resp.Service.Owner.CreatedBy.Source) - } - r.Service.Owner.Description = types.StringPointerValue(resp.Service.Owner.Description) - r.Service.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Service.Owner.Functionalities) > len(resp.Service.Owner.Functionalities) { - r.Service.Owner.Functionalities = r.Service.Owner.Functionalities[:len(resp.Service.Owner.Functionalities)] - } - for functionalitiesCount6, functionalitiesItem6 := range resp.Service.Owner.Functionalities { - var functionalities13 tfTypes.FunctionalityEntity - functionalities13.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem6.ActiveIncidents { - functionalities13.ActiveIncidents = append(functionalities13.ActiveIncidents, types.StringValue(v)) - } - functionalities13.AlertOnAdd = types.BoolPointerValue(functionalitiesItem6.AlertOnAdd) - functionalities13.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem6.AutoAddRespondingTeam) - if functionalitiesItem6.CreatedAt != nil { - functionalities13.CreatedAt = types.StringValue(functionalitiesItem6.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities13.CreatedAt = types.StringNull() - } - functionalities13.Description = types.StringPointerValue(functionalitiesItem6.Description) - functionalities13.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount12, externalResourcesItem12 := range functionalitiesItem6.ExternalResources { - var externalResources25 tfTypes.ExternalResourceEntity - externalResources25.ConnectionID = types.StringPointerValue(externalResourcesItem12.ConnectionID) - externalResources25.ConnectionName = types.StringPointerValue(externalResourcesItem12.ConnectionName) - externalResources25.ConnectionType = types.StringPointerValue(externalResourcesItem12.ConnectionType) - if externalResourcesItem12.CreatedAt != nil { - externalResources25.CreatedAt = types.StringValue(externalResourcesItem12.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources25.CreatedAt = types.StringNull() - } - externalResources25.Name = types.StringPointerValue(externalResourcesItem12.Name) - externalResources25.RemoteID = types.StringPointerValue(externalResourcesItem12.RemoteID) - externalResources25.RemoteURL = types.StringPointerValue(externalResourcesItem12.RemoteURL) - if externalResourcesItem12.UpdatedAt != nil { - externalResources25.UpdatedAt = types.StringValue(externalResourcesItem12.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources25.UpdatedAt = types.StringNull() - } - if externalResourcesCount12+1 > len(functionalities13.ExternalResources) { - functionalities13.ExternalResources = append(functionalities13.ExternalResources, externalResources25) - } else { - functionalities13.ExternalResources[externalResourcesCount12].ConnectionID = externalResources25.ConnectionID - functionalities13.ExternalResources[externalResourcesCount12].ConnectionName = externalResources25.ConnectionName - functionalities13.ExternalResources[externalResourcesCount12].ConnectionType = externalResources25.ConnectionType - functionalities13.ExternalResources[externalResourcesCount12].CreatedAt = externalResources25.CreatedAt - functionalities13.ExternalResources[externalResourcesCount12].Name = externalResources25.Name - functionalities13.ExternalResources[externalResourcesCount12].RemoteID = externalResources25.RemoteID - functionalities13.ExternalResources[externalResourcesCount12].RemoteURL = externalResources25.RemoteURL - functionalities13.ExternalResources[externalResourcesCount12].UpdatedAt = externalResources25.UpdatedAt - } - } - functionalities13.ID = types.StringPointerValue(functionalitiesItem6.ID) - if len(functionalitiesItem6.Labels) > 0 { - functionalities13.Labels = make(map[string]types.String) - for key12, value16 := range functionalitiesItem6.Labels { - functionalities13.Labels[key12] = types.StringValue(value16) - } - } - functionalities13.Links = []tfTypes.LinksEntity{} - for linksCount12, linksItem12 := range functionalitiesItem6.Links { - var links25 tfTypes.LinksEntity - links25.HrefURL = types.StringPointerValue(linksItem12.HrefURL) - links25.IconURL = types.StringPointerValue(linksItem12.IconURL) - links25.ID = types.StringPointerValue(linksItem12.ID) - links25.Name = types.StringPointerValue(linksItem12.Name) - if linksCount12+1 > len(functionalities13.Links) { - functionalities13.Links = append(functionalities13.Links, links25) - } else { - functionalities13.Links[linksCount12].HrefURL = links25.HrefURL - functionalities13.Links[linksCount12].IconURL = links25.IconURL - functionalities13.Links[linksCount12].ID = links25.ID - functionalities13.Links[linksCount12].Name = links25.Name - } - } - functionalities13.Name = types.StringPointerValue(functionalitiesItem6.Name) - if functionalitiesItem6.Owner == nil { - functionalities13.Owner = nil - } else { - functionalities13.Owner = &tfTypes.TeamEntity1{} - } - functionalities13.Slug = types.StringPointerValue(functionalitiesItem6.Slug) - if functionalitiesItem6.UpdatedAt != nil { - functionalities13.UpdatedAt = types.StringValue(functionalitiesItem6.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities13.UpdatedAt = types.StringNull() - } - if functionalitiesItem6.UpdatedBy == nil { - functionalities13.UpdatedBy = nil - } else { - functionalities13.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities13.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem6.UpdatedBy.Email) - functionalities13.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem6.UpdatedBy.ID) - functionalities13.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem6.UpdatedBy.Name) - functionalities13.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem6.UpdatedBy.Source) - } - if functionalitiesCount6+1 > len(r.Service.Owner.Functionalities) { - r.Service.Owner.Functionalities = append(r.Service.Owner.Functionalities, functionalities13) - } else { - r.Service.Owner.Functionalities[functionalitiesCount6].ActiveIncidents = functionalities13.ActiveIncidents - r.Service.Owner.Functionalities[functionalitiesCount6].AlertOnAdd = functionalities13.AlertOnAdd - r.Service.Owner.Functionalities[functionalitiesCount6].AutoAddRespondingTeam = functionalities13.AutoAddRespondingTeam - r.Service.Owner.Functionalities[functionalitiesCount6].CreatedAt = functionalities13.CreatedAt - r.Service.Owner.Functionalities[functionalitiesCount6].Description = functionalities13.Description - r.Service.Owner.Functionalities[functionalitiesCount6].ExternalResources = functionalities13.ExternalResources - r.Service.Owner.Functionalities[functionalitiesCount6].ID = functionalities13.ID - r.Service.Owner.Functionalities[functionalitiesCount6].Labels = functionalities13.Labels - r.Service.Owner.Functionalities[functionalitiesCount6].Links = functionalities13.Links - r.Service.Owner.Functionalities[functionalitiesCount6].Name = functionalities13.Name - r.Service.Owner.Functionalities[functionalitiesCount6].Owner = functionalities13.Owner - r.Service.Owner.Functionalities[functionalitiesCount6].Slug = functionalities13.Slug - r.Service.Owner.Functionalities[functionalitiesCount6].UpdatedAt = functionalities13.UpdatedAt - r.Service.Owner.Functionalities[functionalitiesCount6].UpdatedBy = functionalities13.UpdatedBy - } - } - r.Service.Owner.ID = types.StringPointerValue(resp.Service.Owner.ID) - r.Service.Owner.Memberships = []tfTypes.MembershipEntity{} - if len(r.Service.Owner.Memberships) > len(resp.Service.Owner.Memberships) { - r.Service.Owner.Memberships = r.Service.Owner.Memberships[:len(resp.Service.Owner.Memberships)] - } - for membershipsCount4, membershipsItem4 := range resp.Service.Owner.Memberships { - var memberships9 tfTypes.MembershipEntity - if membershipsItem4.DefaultIncidentRole == nil { - memberships9.DefaultIncidentRole = nil - } else { - memberships9.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem4.DefaultIncidentRole.CreatedAt != nil { - memberships9.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem4.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships9.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships9.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem4.DefaultIncidentRole.Description) - if membershipsItem4.DefaultIncidentRole.DiscardedAt != nil { - memberships9.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem4.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships9.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships9.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem4.DefaultIncidentRole.ID) - memberships9.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem4.DefaultIncidentRole.Name) - memberships9.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem4.DefaultIncidentRole.Summary) - if membershipsItem4.DefaultIncidentRole.UpdatedAt != nil { - memberships9.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem4.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships9.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem4.Schedule == nil { - memberships9.Schedule = nil - } else { - memberships9.Schedule = &tfTypes.ScheduleEntity{} - memberships9.Schedule.Discarded = types.BoolPointerValue(membershipsItem4.Schedule.Discarded) - memberships9.Schedule.ID = types.StringPointerValue(membershipsItem4.Schedule.ID) - memberships9.Schedule.Integration = types.StringPointerValue(membershipsItem4.Schedule.Integration) - memberships9.Schedule.Name = types.StringPointerValue(membershipsItem4.Schedule.Name) - } - if membershipsItem4.User == nil { - memberships9.User = nil - } else { - memberships9.User = &tfTypes.UserEntity{} - if membershipsItem4.User.CreatedAt != nil { - memberships9.User.CreatedAt = types.StringValue(membershipsItem4.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships9.User.CreatedAt = types.StringNull() - } - memberships9.User.Email = types.StringPointerValue(membershipsItem4.User.Email) - memberships9.User.ID = types.StringPointerValue(membershipsItem4.User.ID) - memberships9.User.Name = types.StringPointerValue(membershipsItem4.User.Name) - memberships9.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem4.User.SignalsEnabledNotificationTypes { - memberships9.User.SignalsEnabledNotificationTypes = append(memberships9.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships9.User.SlackLinked = types.BoolPointerValue(membershipsItem4.User.SlackLinked) - memberships9.User.SlackUserID = types.StringPointerValue(membershipsItem4.User.SlackUserID) - if membershipsItem4.User.UpdatedAt != nil { - memberships9.User.UpdatedAt = types.StringValue(membershipsItem4.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships9.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount4+1 > len(r.Service.Owner.Memberships) { - r.Service.Owner.Memberships = append(r.Service.Owner.Memberships, memberships9) - } else { - r.Service.Owner.Memberships[membershipsCount4].DefaultIncidentRole = memberships9.DefaultIncidentRole - r.Service.Owner.Memberships[membershipsCount4].Schedule = memberships9.Schedule - r.Service.Owner.Memberships[membershipsCount4].User = memberships9.User - } - } - if resp.Service.Owner.MsTeamsChannel == nil { - r.Service.Owner.MsTeamsChannel = nil - } else { - r.Service.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.Service.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.ChannelID) - r.Service.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.ChannelName) - r.Service.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.ChannelURL) - r.Service.Owner.MsTeamsChannel.ID = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.ID) - r.Service.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.MsTeamID) - r.Service.Owner.MsTeamsChannel.Status = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.Status) - r.Service.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(resp.Service.Owner.MsTeamsChannel.TeamName) - } - r.Service.Owner.Name = types.StringPointerValue(resp.Service.Owner.Name) - r.Service.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.Service.Owner.OwnedFunctionalities) > len(resp.Service.Owner.OwnedFunctionalities) { - r.Service.Owner.OwnedFunctionalities = r.Service.Owner.OwnedFunctionalities[:len(resp.Service.Owner.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount4, ownedFunctionalitiesItem4 := range resp.Service.Owner.OwnedFunctionalities { - var ownedFunctionalities9 tfTypes.FunctionalityEntity - ownedFunctionalities9.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem4.ActiveIncidents { - ownedFunctionalities9.ActiveIncidents = append(ownedFunctionalities9.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities9.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem4.AlertOnAdd) - ownedFunctionalities9.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem4.AutoAddRespondingTeam) - if ownedFunctionalitiesItem4.CreatedAt != nil { - ownedFunctionalities9.CreatedAt = types.StringValue(ownedFunctionalitiesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities9.CreatedAt = types.StringNull() - } - ownedFunctionalities9.Description = types.StringPointerValue(ownedFunctionalitiesItem4.Description) - ownedFunctionalities9.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount13, externalResourcesItem13 := range ownedFunctionalitiesItem4.ExternalResources { - var externalResources27 tfTypes.ExternalResourceEntity - externalResources27.ConnectionID = types.StringPointerValue(externalResourcesItem13.ConnectionID) - externalResources27.ConnectionName = types.StringPointerValue(externalResourcesItem13.ConnectionName) - externalResources27.ConnectionType = types.StringPointerValue(externalResourcesItem13.ConnectionType) - if externalResourcesItem13.CreatedAt != nil { - externalResources27.CreatedAt = types.StringValue(externalResourcesItem13.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources27.CreatedAt = types.StringNull() - } - externalResources27.Name = types.StringPointerValue(externalResourcesItem13.Name) - externalResources27.RemoteID = types.StringPointerValue(externalResourcesItem13.RemoteID) - externalResources27.RemoteURL = types.StringPointerValue(externalResourcesItem13.RemoteURL) - if externalResourcesItem13.UpdatedAt != nil { - externalResources27.UpdatedAt = types.StringValue(externalResourcesItem13.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources27.UpdatedAt = types.StringNull() - } - if externalResourcesCount13+1 > len(ownedFunctionalities9.ExternalResources) { - ownedFunctionalities9.ExternalResources = append(ownedFunctionalities9.ExternalResources, externalResources27) - } else { - ownedFunctionalities9.ExternalResources[externalResourcesCount13].ConnectionID = externalResources27.ConnectionID - ownedFunctionalities9.ExternalResources[externalResourcesCount13].ConnectionName = externalResources27.ConnectionName - ownedFunctionalities9.ExternalResources[externalResourcesCount13].ConnectionType = externalResources27.ConnectionType - ownedFunctionalities9.ExternalResources[externalResourcesCount13].CreatedAt = externalResources27.CreatedAt - ownedFunctionalities9.ExternalResources[externalResourcesCount13].Name = externalResources27.Name - ownedFunctionalities9.ExternalResources[externalResourcesCount13].RemoteID = externalResources27.RemoteID - ownedFunctionalities9.ExternalResources[externalResourcesCount13].RemoteURL = externalResources27.RemoteURL - ownedFunctionalities9.ExternalResources[externalResourcesCount13].UpdatedAt = externalResources27.UpdatedAt - } - } - ownedFunctionalities9.ID = types.StringPointerValue(ownedFunctionalitiesItem4.ID) - if len(ownedFunctionalitiesItem4.Labels) > 0 { - ownedFunctionalities9.Labels = make(map[string]types.String) - for key13, value17 := range ownedFunctionalitiesItem4.Labels { - ownedFunctionalities9.Labels[key13] = types.StringValue(value17) - } - } - ownedFunctionalities9.Links = []tfTypes.LinksEntity{} - for linksCount13, linksItem13 := range ownedFunctionalitiesItem4.Links { - var links27 tfTypes.LinksEntity - links27.HrefURL = types.StringPointerValue(linksItem13.HrefURL) - links27.IconURL = types.StringPointerValue(linksItem13.IconURL) - links27.ID = types.StringPointerValue(linksItem13.ID) - links27.Name = types.StringPointerValue(linksItem13.Name) - if linksCount13+1 > len(ownedFunctionalities9.Links) { - ownedFunctionalities9.Links = append(ownedFunctionalities9.Links, links27) - } else { - ownedFunctionalities9.Links[linksCount13].HrefURL = links27.HrefURL - ownedFunctionalities9.Links[linksCount13].IconURL = links27.IconURL - ownedFunctionalities9.Links[linksCount13].ID = links27.ID - ownedFunctionalities9.Links[linksCount13].Name = links27.Name - } - } - ownedFunctionalities9.Name = types.StringPointerValue(ownedFunctionalitiesItem4.Name) - if ownedFunctionalitiesItem4.Owner == nil { - ownedFunctionalities9.Owner = nil - } else { - ownedFunctionalities9.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities9.Slug = types.StringPointerValue(ownedFunctionalitiesItem4.Slug) - if ownedFunctionalitiesItem4.UpdatedAt != nil { - ownedFunctionalities9.UpdatedAt = types.StringValue(ownedFunctionalitiesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities9.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem4.UpdatedBy == nil { - ownedFunctionalities9.UpdatedBy = nil - } else { - ownedFunctionalities9.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities9.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem4.UpdatedBy.Email) - ownedFunctionalities9.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem4.UpdatedBy.ID) - ownedFunctionalities9.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem4.UpdatedBy.Name) - ownedFunctionalities9.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem4.UpdatedBy.Source) - } - if ownedFunctionalitiesCount4+1 > len(r.Service.Owner.OwnedFunctionalities) { - r.Service.Owner.OwnedFunctionalities = append(r.Service.Owner.OwnedFunctionalities, ownedFunctionalities9) - } else { - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].ActiveIncidents = ownedFunctionalities9.ActiveIncidents - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].AlertOnAdd = ownedFunctionalities9.AlertOnAdd - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].AutoAddRespondingTeam = ownedFunctionalities9.AutoAddRespondingTeam - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].CreatedAt = ownedFunctionalities9.CreatedAt - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Description = ownedFunctionalities9.Description - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].ExternalResources = ownedFunctionalities9.ExternalResources - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].ID = ownedFunctionalities9.ID - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Labels = ownedFunctionalities9.Labels - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Links = ownedFunctionalities9.Links - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Name = ownedFunctionalities9.Name - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Owner = ownedFunctionalities9.Owner - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].Slug = ownedFunctionalities9.Slug - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].UpdatedAt = ownedFunctionalities9.UpdatedAt - r.Service.Owner.OwnedFunctionalities[ownedFunctionalitiesCount4].UpdatedBy = ownedFunctionalities9.UpdatedBy - } - } - r.Service.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.Service.Owner.OwnedRunbooks) > len(resp.Service.Owner.OwnedRunbooks) { - r.Service.Owner.OwnedRunbooks = r.Service.Owner.OwnedRunbooks[:len(resp.Service.Owner.OwnedRunbooks)] - } - for ownedRunbooksCount4, ownedRunbooksItem4 := range resp.Service.Owner.OwnedRunbooks { - var ownedRunbooks9 tfTypes.SlimRunbookEntity - if ownedRunbooksItem4.AttachmentRule == nil { - ownedRunbooks9.AttachmentRule = nil - } else { - ownedRunbooks9.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem4.AttachmentRule.Logic == nil { - ownedRunbooks9.AttachmentRule.Logic = nil - } else { - ownedRunbooks9.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem4.AttachmentRule.UserData == nil { - ownedRunbooks9.AttachmentRule.UserData = nil - } else { - ownedRunbooks9.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks9.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem4.AttachmentRule.UserData.Label) - ownedRunbooks9.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem4.AttachmentRule.UserData.Type) - ownedRunbooks9.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem4.AttachmentRule.UserData.Value) - } - } - ownedRunbooks9.Categories = types.StringPointerValue(ownedRunbooksItem4.Categories) - if ownedRunbooksItem4.CreatedAt != nil { - ownedRunbooks9.CreatedAt = types.StringValue(ownedRunbooksItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks9.CreatedAt = types.StringNull() - } - ownedRunbooks9.Description = types.StringPointerValue(ownedRunbooksItem4.Description) - ownedRunbooks9.ID = types.StringPointerValue(ownedRunbooksItem4.ID) - ownedRunbooks9.Name = types.StringPointerValue(ownedRunbooksItem4.Name) - if ownedRunbooksItem4.Owner == nil { - ownedRunbooks9.Owner = nil - } else { - ownedRunbooks9.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks9.Summary = types.StringPointerValue(ownedRunbooksItem4.Summary) - ownedRunbooks9.Type = types.StringPointerValue(ownedRunbooksItem4.Type) - if ownedRunbooksItem4.UpdatedAt != nil { - ownedRunbooks9.UpdatedAt = types.StringValue(ownedRunbooksItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks9.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount4+1 > len(r.Service.Owner.OwnedRunbooks) { - r.Service.Owner.OwnedRunbooks = append(r.Service.Owner.OwnedRunbooks, ownedRunbooks9) - } else { - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].AttachmentRule = ownedRunbooks9.AttachmentRule - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Categories = ownedRunbooks9.Categories - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].CreatedAt = ownedRunbooks9.CreatedAt - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Description = ownedRunbooks9.Description - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].ID = ownedRunbooks9.ID - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Name = ownedRunbooks9.Name - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Owner = ownedRunbooks9.Owner - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Summary = ownedRunbooks9.Summary - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].Type = ownedRunbooks9.Type - r.Service.Owner.OwnedRunbooks[ownedRunbooksCount4].UpdatedAt = ownedRunbooks9.UpdatedAt - } - } - r.Service.Owner.SignalsIcalURL = types.StringPointerValue(resp.Service.Owner.SignalsIcalURL) - if resp.Service.Owner.SlackChannel == nil { - r.Service.Owner.SlackChannel = nil - } else { - r.Service.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.Service.Owner.SlackChannel.ID = types.StringPointerValue(resp.Service.Owner.SlackChannel.ID) - r.Service.Owner.SlackChannel.Name = types.StringPointerValue(resp.Service.Owner.SlackChannel.Name) - r.Service.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(resp.Service.Owner.SlackChannel.SlackChannelID) - } - r.Service.Owner.Slug = types.StringPointerValue(resp.Service.Owner.Slug) - if resp.Service.Owner.UpdatedAt != nil { - r.Service.Owner.UpdatedAt = types.StringValue(resp.Service.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.Owner.UpdatedAt = types.StringNull() - } - } - if resp.Service.ServiceChecklistUpdatedAt != nil { - r.Service.ServiceChecklistUpdatedAt = types.StringValue(resp.Service.ServiceChecklistUpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.ServiceChecklistUpdatedAt = types.StringNull() - } - if resp.Service.ServiceTier != nil { - r.Service.ServiceTier = types.Int64Value(int64(*resp.Service.ServiceTier)) - } else { - r.Service.ServiceTier = types.Int64Null() - } - r.Service.Slug = types.StringPointerValue(resp.Service.Slug) - r.Service.Teams = []tfTypes.TeamEntity{} - if len(r.Service.Teams) > len(resp.Service.Teams) { - r.Service.Teams = r.Service.Teams[:len(resp.Service.Teams)] - } - for teamsCount1, teamsItem1 := range resp.Service.Teams { - var teams3 tfTypes.TeamEntity - if teamsItem1.CreatedAt != nil { - teams3.CreatedAt = types.StringValue(teamsItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams3.CreatedAt = types.StringNull() - } - if teamsItem1.CreatedBy == nil { - teams3.CreatedBy = nil - } else { - teams3.CreatedBy = &tfTypes.AuthorEntity{} - teams3.CreatedBy.Email = types.StringPointerValue(teamsItem1.CreatedBy.Email) - teams3.CreatedBy.ID = types.StringPointerValue(teamsItem1.CreatedBy.ID) - teams3.CreatedBy.Name = types.StringPointerValue(teamsItem1.CreatedBy.Name) - teams3.CreatedBy.Source = types.StringPointerValue(teamsItem1.CreatedBy.Source) - } - teams3.Description = types.StringPointerValue(teamsItem1.Description) - teams3.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount7, functionalitiesItem7 := range teamsItem1.Functionalities { - var functionalities15 tfTypes.FunctionalityEntity - functionalities15.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem7.ActiveIncidents { - functionalities15.ActiveIncidents = append(functionalities15.ActiveIncidents, types.StringValue(v)) - } - functionalities15.AlertOnAdd = types.BoolPointerValue(functionalitiesItem7.AlertOnAdd) - functionalities15.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem7.AutoAddRespondingTeam) - if functionalitiesItem7.CreatedAt != nil { - functionalities15.CreatedAt = types.StringValue(functionalitiesItem7.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities15.CreatedAt = types.StringNull() - } - functionalities15.Description = types.StringPointerValue(functionalitiesItem7.Description) - functionalities15.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount14, externalResourcesItem14 := range functionalitiesItem7.ExternalResources { - var externalResources29 tfTypes.ExternalResourceEntity - externalResources29.ConnectionID = types.StringPointerValue(externalResourcesItem14.ConnectionID) - externalResources29.ConnectionName = types.StringPointerValue(externalResourcesItem14.ConnectionName) - externalResources29.ConnectionType = types.StringPointerValue(externalResourcesItem14.ConnectionType) - if externalResourcesItem14.CreatedAt != nil { - externalResources29.CreatedAt = types.StringValue(externalResourcesItem14.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources29.CreatedAt = types.StringNull() - } - externalResources29.Name = types.StringPointerValue(externalResourcesItem14.Name) - externalResources29.RemoteID = types.StringPointerValue(externalResourcesItem14.RemoteID) - externalResources29.RemoteURL = types.StringPointerValue(externalResourcesItem14.RemoteURL) - if externalResourcesItem14.UpdatedAt != nil { - externalResources29.UpdatedAt = types.StringValue(externalResourcesItem14.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources29.UpdatedAt = types.StringNull() - } - if externalResourcesCount14+1 > len(functionalities15.ExternalResources) { - functionalities15.ExternalResources = append(functionalities15.ExternalResources, externalResources29) - } else { - functionalities15.ExternalResources[externalResourcesCount14].ConnectionID = externalResources29.ConnectionID - functionalities15.ExternalResources[externalResourcesCount14].ConnectionName = externalResources29.ConnectionName - functionalities15.ExternalResources[externalResourcesCount14].ConnectionType = externalResources29.ConnectionType - functionalities15.ExternalResources[externalResourcesCount14].CreatedAt = externalResources29.CreatedAt - functionalities15.ExternalResources[externalResourcesCount14].Name = externalResources29.Name - functionalities15.ExternalResources[externalResourcesCount14].RemoteID = externalResources29.RemoteID - functionalities15.ExternalResources[externalResourcesCount14].RemoteURL = externalResources29.RemoteURL - functionalities15.ExternalResources[externalResourcesCount14].UpdatedAt = externalResources29.UpdatedAt - } - } - functionalities15.ID = types.StringPointerValue(functionalitiesItem7.ID) - if len(functionalitiesItem7.Labels) > 0 { - functionalities15.Labels = make(map[string]types.String) - for key14, value19 := range functionalitiesItem7.Labels { - functionalities15.Labels[key14] = types.StringValue(value19) - } - } - functionalities15.Links = []tfTypes.LinksEntity{} - for linksCount14, linksItem14 := range functionalitiesItem7.Links { - var links29 tfTypes.LinksEntity - links29.HrefURL = types.StringPointerValue(linksItem14.HrefURL) - links29.IconURL = types.StringPointerValue(linksItem14.IconURL) - links29.ID = types.StringPointerValue(linksItem14.ID) - links29.Name = types.StringPointerValue(linksItem14.Name) - if linksCount14+1 > len(functionalities15.Links) { - functionalities15.Links = append(functionalities15.Links, links29) - } else { - functionalities15.Links[linksCount14].HrefURL = links29.HrefURL - functionalities15.Links[linksCount14].IconURL = links29.IconURL - functionalities15.Links[linksCount14].ID = links29.ID - functionalities15.Links[linksCount14].Name = links29.Name - } - } - functionalities15.Name = types.StringPointerValue(functionalitiesItem7.Name) - if functionalitiesItem7.Owner == nil { - functionalities15.Owner = nil - } else { - functionalities15.Owner = &tfTypes.TeamEntity1{} - } - functionalities15.Slug = types.StringPointerValue(functionalitiesItem7.Slug) - if functionalitiesItem7.UpdatedAt != nil { - functionalities15.UpdatedAt = types.StringValue(functionalitiesItem7.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities15.UpdatedAt = types.StringNull() - } - if functionalitiesItem7.UpdatedBy == nil { - functionalities15.UpdatedBy = nil - } else { - functionalities15.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities15.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem7.UpdatedBy.Email) - functionalities15.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem7.UpdatedBy.ID) - functionalities15.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem7.UpdatedBy.Name) - functionalities15.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem7.UpdatedBy.Source) - } - if functionalitiesCount7+1 > len(teams3.Functionalities) { - teams3.Functionalities = append(teams3.Functionalities, functionalities15) - } else { - teams3.Functionalities[functionalitiesCount7].ActiveIncidents = functionalities15.ActiveIncidents - teams3.Functionalities[functionalitiesCount7].AlertOnAdd = functionalities15.AlertOnAdd - teams3.Functionalities[functionalitiesCount7].AutoAddRespondingTeam = functionalities15.AutoAddRespondingTeam - teams3.Functionalities[functionalitiesCount7].CreatedAt = functionalities15.CreatedAt - teams3.Functionalities[functionalitiesCount7].Description = functionalities15.Description - teams3.Functionalities[functionalitiesCount7].ExternalResources = functionalities15.ExternalResources - teams3.Functionalities[functionalitiesCount7].ID = functionalities15.ID - teams3.Functionalities[functionalitiesCount7].Labels = functionalities15.Labels - teams3.Functionalities[functionalitiesCount7].Links = functionalities15.Links - teams3.Functionalities[functionalitiesCount7].Name = functionalities15.Name - teams3.Functionalities[functionalitiesCount7].Owner = functionalities15.Owner - teams3.Functionalities[functionalitiesCount7].Slug = functionalities15.Slug - teams3.Functionalities[functionalitiesCount7].UpdatedAt = functionalities15.UpdatedAt - teams3.Functionalities[functionalitiesCount7].UpdatedBy = functionalities15.UpdatedBy - } - } - teams3.ID = types.StringPointerValue(teamsItem1.ID) - teams3.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount5, membershipsItem5 := range teamsItem1.Memberships { - var memberships11 tfTypes.MembershipEntity - if membershipsItem5.DefaultIncidentRole == nil { - memberships11.DefaultIncidentRole = nil - } else { - memberships11.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem5.DefaultIncidentRole.CreatedAt != nil { - memberships11.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem5.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships11.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships11.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem5.DefaultIncidentRole.Description) - if membershipsItem5.DefaultIncidentRole.DiscardedAt != nil { - memberships11.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem5.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships11.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships11.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem5.DefaultIncidentRole.ID) - memberships11.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem5.DefaultIncidentRole.Name) - memberships11.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem5.DefaultIncidentRole.Summary) - if membershipsItem5.DefaultIncidentRole.UpdatedAt != nil { - memberships11.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem5.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships11.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem5.Schedule == nil { - memberships11.Schedule = nil - } else { - memberships11.Schedule = &tfTypes.ScheduleEntity{} - memberships11.Schedule.Discarded = types.BoolPointerValue(membershipsItem5.Schedule.Discarded) - memberships11.Schedule.ID = types.StringPointerValue(membershipsItem5.Schedule.ID) - memberships11.Schedule.Integration = types.StringPointerValue(membershipsItem5.Schedule.Integration) - memberships11.Schedule.Name = types.StringPointerValue(membershipsItem5.Schedule.Name) - } - if membershipsItem5.User == nil { - memberships11.User = nil - } else { - memberships11.User = &tfTypes.UserEntity{} - if membershipsItem5.User.CreatedAt != nil { - memberships11.User.CreatedAt = types.StringValue(membershipsItem5.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships11.User.CreatedAt = types.StringNull() - } - memberships11.User.Email = types.StringPointerValue(membershipsItem5.User.Email) - memberships11.User.ID = types.StringPointerValue(membershipsItem5.User.ID) - memberships11.User.Name = types.StringPointerValue(membershipsItem5.User.Name) - memberships11.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem5.User.SignalsEnabledNotificationTypes { - memberships11.User.SignalsEnabledNotificationTypes = append(memberships11.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships11.User.SlackLinked = types.BoolPointerValue(membershipsItem5.User.SlackLinked) - memberships11.User.SlackUserID = types.StringPointerValue(membershipsItem5.User.SlackUserID) - if membershipsItem5.User.UpdatedAt != nil { - memberships11.User.UpdatedAt = types.StringValue(membershipsItem5.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships11.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount5+1 > len(teams3.Memberships) { - teams3.Memberships = append(teams3.Memberships, memberships11) - } else { - teams3.Memberships[membershipsCount5].DefaultIncidentRole = memberships11.DefaultIncidentRole - teams3.Memberships[membershipsCount5].Schedule = memberships11.Schedule - teams3.Memberships[membershipsCount5].User = memberships11.User - } - } - if teamsItem1.MsTeamsChannel == nil { - teams3.MsTeamsChannel = nil - } else { - teams3.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams3.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem1.MsTeamsChannel.ChannelID) - teams3.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem1.MsTeamsChannel.ChannelName) - teams3.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem1.MsTeamsChannel.ChannelURL) - teams3.MsTeamsChannel.ID = types.StringPointerValue(teamsItem1.MsTeamsChannel.ID) - teams3.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem1.MsTeamsChannel.MsTeamID) - teams3.MsTeamsChannel.Status = types.StringPointerValue(teamsItem1.MsTeamsChannel.Status) - teams3.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem1.MsTeamsChannel.TeamName) - } - teams3.Name = types.StringPointerValue(teamsItem1.Name) - teams3.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount5, ownedFunctionalitiesItem5 := range teamsItem1.OwnedFunctionalities { - var ownedFunctionalities11 tfTypes.FunctionalityEntity - ownedFunctionalities11.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem5.ActiveIncidents { - ownedFunctionalities11.ActiveIncidents = append(ownedFunctionalities11.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities11.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem5.AlertOnAdd) - ownedFunctionalities11.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem5.AutoAddRespondingTeam) - if ownedFunctionalitiesItem5.CreatedAt != nil { - ownedFunctionalities11.CreatedAt = types.StringValue(ownedFunctionalitiesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities11.CreatedAt = types.StringNull() - } - ownedFunctionalities11.Description = types.StringPointerValue(ownedFunctionalitiesItem5.Description) - ownedFunctionalities11.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount15, externalResourcesItem15 := range ownedFunctionalitiesItem5.ExternalResources { - var externalResources31 tfTypes.ExternalResourceEntity - externalResources31.ConnectionID = types.StringPointerValue(externalResourcesItem15.ConnectionID) - externalResources31.ConnectionName = types.StringPointerValue(externalResourcesItem15.ConnectionName) - externalResources31.ConnectionType = types.StringPointerValue(externalResourcesItem15.ConnectionType) - if externalResourcesItem15.CreatedAt != nil { - externalResources31.CreatedAt = types.StringValue(externalResourcesItem15.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources31.CreatedAt = types.StringNull() - } - externalResources31.Name = types.StringPointerValue(externalResourcesItem15.Name) - externalResources31.RemoteID = types.StringPointerValue(externalResourcesItem15.RemoteID) - externalResources31.RemoteURL = types.StringPointerValue(externalResourcesItem15.RemoteURL) - if externalResourcesItem15.UpdatedAt != nil { - externalResources31.UpdatedAt = types.StringValue(externalResourcesItem15.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources31.UpdatedAt = types.StringNull() - } - if externalResourcesCount15+1 > len(ownedFunctionalities11.ExternalResources) { - ownedFunctionalities11.ExternalResources = append(ownedFunctionalities11.ExternalResources, externalResources31) - } else { - ownedFunctionalities11.ExternalResources[externalResourcesCount15].ConnectionID = externalResources31.ConnectionID - ownedFunctionalities11.ExternalResources[externalResourcesCount15].ConnectionName = externalResources31.ConnectionName - ownedFunctionalities11.ExternalResources[externalResourcesCount15].ConnectionType = externalResources31.ConnectionType - ownedFunctionalities11.ExternalResources[externalResourcesCount15].CreatedAt = externalResources31.CreatedAt - ownedFunctionalities11.ExternalResources[externalResourcesCount15].Name = externalResources31.Name - ownedFunctionalities11.ExternalResources[externalResourcesCount15].RemoteID = externalResources31.RemoteID - ownedFunctionalities11.ExternalResources[externalResourcesCount15].RemoteURL = externalResources31.RemoteURL - ownedFunctionalities11.ExternalResources[externalResourcesCount15].UpdatedAt = externalResources31.UpdatedAt - } - } - ownedFunctionalities11.ID = types.StringPointerValue(ownedFunctionalitiesItem5.ID) - if len(ownedFunctionalitiesItem5.Labels) > 0 { - ownedFunctionalities11.Labels = make(map[string]types.String) - for key15, value20 := range ownedFunctionalitiesItem5.Labels { - ownedFunctionalities11.Labels[key15] = types.StringValue(value20) - } - } - ownedFunctionalities11.Links = []tfTypes.LinksEntity{} - for linksCount15, linksItem15 := range ownedFunctionalitiesItem5.Links { - var links31 tfTypes.LinksEntity - links31.HrefURL = types.StringPointerValue(linksItem15.HrefURL) - links31.IconURL = types.StringPointerValue(linksItem15.IconURL) - links31.ID = types.StringPointerValue(linksItem15.ID) - links31.Name = types.StringPointerValue(linksItem15.Name) - if linksCount15+1 > len(ownedFunctionalities11.Links) { - ownedFunctionalities11.Links = append(ownedFunctionalities11.Links, links31) - } else { - ownedFunctionalities11.Links[linksCount15].HrefURL = links31.HrefURL - ownedFunctionalities11.Links[linksCount15].IconURL = links31.IconURL - ownedFunctionalities11.Links[linksCount15].ID = links31.ID - ownedFunctionalities11.Links[linksCount15].Name = links31.Name - } - } - ownedFunctionalities11.Name = types.StringPointerValue(ownedFunctionalitiesItem5.Name) - if ownedFunctionalitiesItem5.Owner == nil { - ownedFunctionalities11.Owner = nil - } else { - ownedFunctionalities11.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities11.Slug = types.StringPointerValue(ownedFunctionalitiesItem5.Slug) - if ownedFunctionalitiesItem5.UpdatedAt != nil { - ownedFunctionalities11.UpdatedAt = types.StringValue(ownedFunctionalitiesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities11.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem5.UpdatedBy == nil { - ownedFunctionalities11.UpdatedBy = nil - } else { - ownedFunctionalities11.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities11.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem5.UpdatedBy.Email) - ownedFunctionalities11.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem5.UpdatedBy.ID) - ownedFunctionalities11.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem5.UpdatedBy.Name) - ownedFunctionalities11.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem5.UpdatedBy.Source) - } - if ownedFunctionalitiesCount5+1 > len(teams3.OwnedFunctionalities) { - teams3.OwnedFunctionalities = append(teams3.OwnedFunctionalities, ownedFunctionalities11) - } else { - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].ActiveIncidents = ownedFunctionalities11.ActiveIncidents - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].AlertOnAdd = ownedFunctionalities11.AlertOnAdd - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].AutoAddRespondingTeam = ownedFunctionalities11.AutoAddRespondingTeam - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].CreatedAt = ownedFunctionalities11.CreatedAt - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Description = ownedFunctionalities11.Description - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].ExternalResources = ownedFunctionalities11.ExternalResources - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].ID = ownedFunctionalities11.ID - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Labels = ownedFunctionalities11.Labels - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Links = ownedFunctionalities11.Links - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Name = ownedFunctionalities11.Name - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Owner = ownedFunctionalities11.Owner - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].Slug = ownedFunctionalities11.Slug - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].UpdatedAt = ownedFunctionalities11.UpdatedAt - teams3.OwnedFunctionalities[ownedFunctionalitiesCount5].UpdatedBy = ownedFunctionalities11.UpdatedBy - } - } - teams3.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount5, ownedRunbooksItem5 := range teamsItem1.OwnedRunbooks { - var ownedRunbooks11 tfTypes.SlimRunbookEntity - if ownedRunbooksItem5.AttachmentRule == nil { - ownedRunbooks11.AttachmentRule = nil - } else { - ownedRunbooks11.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem5.AttachmentRule.Logic == nil { - ownedRunbooks11.AttachmentRule.Logic = nil - } else { - ownedRunbooks11.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem5.AttachmentRule.UserData == nil { - ownedRunbooks11.AttachmentRule.UserData = nil - } else { - ownedRunbooks11.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks11.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem5.AttachmentRule.UserData.Label) - ownedRunbooks11.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem5.AttachmentRule.UserData.Type) - ownedRunbooks11.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem5.AttachmentRule.UserData.Value) - } - } - ownedRunbooks11.Categories = types.StringPointerValue(ownedRunbooksItem5.Categories) - if ownedRunbooksItem5.CreatedAt != nil { - ownedRunbooks11.CreatedAt = types.StringValue(ownedRunbooksItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks11.CreatedAt = types.StringNull() - } - ownedRunbooks11.Description = types.StringPointerValue(ownedRunbooksItem5.Description) - ownedRunbooks11.ID = types.StringPointerValue(ownedRunbooksItem5.ID) - ownedRunbooks11.Name = types.StringPointerValue(ownedRunbooksItem5.Name) - if ownedRunbooksItem5.Owner == nil { - ownedRunbooks11.Owner = nil - } else { - ownedRunbooks11.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks11.Summary = types.StringPointerValue(ownedRunbooksItem5.Summary) - ownedRunbooks11.Type = types.StringPointerValue(ownedRunbooksItem5.Type) - if ownedRunbooksItem5.UpdatedAt != nil { - ownedRunbooks11.UpdatedAt = types.StringValue(ownedRunbooksItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks11.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount5+1 > len(teams3.OwnedRunbooks) { - teams3.OwnedRunbooks = append(teams3.OwnedRunbooks, ownedRunbooks11) - } else { - teams3.OwnedRunbooks[ownedRunbooksCount5].AttachmentRule = ownedRunbooks11.AttachmentRule - teams3.OwnedRunbooks[ownedRunbooksCount5].Categories = ownedRunbooks11.Categories - teams3.OwnedRunbooks[ownedRunbooksCount5].CreatedAt = ownedRunbooks11.CreatedAt - teams3.OwnedRunbooks[ownedRunbooksCount5].Description = ownedRunbooks11.Description - teams3.OwnedRunbooks[ownedRunbooksCount5].ID = ownedRunbooks11.ID - teams3.OwnedRunbooks[ownedRunbooksCount5].Name = ownedRunbooks11.Name - teams3.OwnedRunbooks[ownedRunbooksCount5].Owner = ownedRunbooks11.Owner - teams3.OwnedRunbooks[ownedRunbooksCount5].Summary = ownedRunbooks11.Summary - teams3.OwnedRunbooks[ownedRunbooksCount5].Type = ownedRunbooks11.Type - teams3.OwnedRunbooks[ownedRunbooksCount5].UpdatedAt = ownedRunbooks11.UpdatedAt - } - } - teams3.SignalsIcalURL = types.StringPointerValue(teamsItem1.SignalsIcalURL) - if teamsItem1.SlackChannel == nil { - teams3.SlackChannel = nil - } else { - teams3.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams3.SlackChannel.ID = types.StringPointerValue(teamsItem1.SlackChannel.ID) - teams3.SlackChannel.Name = types.StringPointerValue(teamsItem1.SlackChannel.Name) - teams3.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem1.SlackChannel.SlackChannelID) - } - teams3.Slug = types.StringPointerValue(teamsItem1.Slug) - if teamsItem1.UpdatedAt != nil { - teams3.UpdatedAt = types.StringValue(teamsItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams3.UpdatedAt = types.StringNull() - } - if teamsCount1+1 > len(r.Service.Teams) { - r.Service.Teams = append(r.Service.Teams, teams3) - } else { - r.Service.Teams[teamsCount1].CreatedAt = teams3.CreatedAt - r.Service.Teams[teamsCount1].CreatedBy = teams3.CreatedBy - r.Service.Teams[teamsCount1].Description = teams3.Description - r.Service.Teams[teamsCount1].Functionalities = teams3.Functionalities - r.Service.Teams[teamsCount1].ID = teams3.ID - r.Service.Teams[teamsCount1].Memberships = teams3.Memberships - r.Service.Teams[teamsCount1].MsTeamsChannel = teams3.MsTeamsChannel - r.Service.Teams[teamsCount1].Name = teams3.Name - r.Service.Teams[teamsCount1].OwnedFunctionalities = teams3.OwnedFunctionalities - r.Service.Teams[teamsCount1].OwnedRunbooks = teams3.OwnedRunbooks - r.Service.Teams[teamsCount1].SignalsIcalURL = teams3.SignalsIcalURL - r.Service.Teams[teamsCount1].SlackChannel = teams3.SlackChannel - r.Service.Teams[teamsCount1].Slug = teams3.Slug - r.Service.Teams[teamsCount1].UpdatedAt = teams3.UpdatedAt - } - } - if resp.Service.UpdatedAt != nil { - r.Service.UpdatedAt = types.StringValue(resp.Service.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.Service.UpdatedAt = types.StringNull() - } - if resp.Service.UpdatedBy == nil { - r.Service.UpdatedBy = nil - } else { - r.Service.UpdatedBy = &tfTypes.AuthorEntity{} - r.Service.UpdatedBy.Email = types.StringPointerValue(resp.Service.UpdatedBy.Email) - r.Service.UpdatedBy.ID = types.StringPointerValue(resp.Service.UpdatedBy.ID) - r.Service.UpdatedBy.Name = types.StringPointerValue(resp.Service.UpdatedBy.Name) - r.Service.UpdatedBy.Source = types.StringPointerValue(resp.Service.UpdatedBy.Source) - } - } - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} - -func (r *ServiceDependencyResourceModel) ToSharedPatchV1ServiceDependenciesServiceDependencyID() *shared.PatchV1ServiceDependenciesServiceDependencyID { - notes := new(string) - if !r.Notes.IsUnknown() && !r.Notes.IsNull() { - *notes = r.Notes.ValueString() - } else { - notes = nil - } - out := shared.PatchV1ServiceDependenciesServiceDependencyID{ - Notes: notes, - } - return &out -} diff --git a/internal/provider/services_data_source.go b/internal/provider/services_data_source.go deleted file mode 100644 index f6dab3e..0000000 --- a/internal/provider/services_data_source.go +++ /dev/null @@ -1,2004 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &ServicesDataSource{} -var _ datasource.DataSourceWithConfigure = &ServicesDataSource{} - -func NewServicesDataSource() datasource.DataSource { - return &ServicesDataSource{} -} - -// ServicesDataSource is the data source implementation. -type ServicesDataSource struct { - client *sdk.Firehydrant -} - -// ServicesDataSourceModel describes the data model. -type ServicesDataSourceModel struct { - AvailableDownstreamDependenciesForID types.String `tfsdk:"available_downstream_dependencies_for_id"` - AvailableUpstreamDependenciesForID types.String `tfsdk:"available_upstream_dependencies_for_id"` - Data []tfTypes.ServiceEntity `tfsdk:"data"` - Functionalities types.String `tfsdk:"functionalities"` - Impacted types.String `tfsdk:"impacted"` - Include []types.String `tfsdk:"include"` - Labels types.String `tfsdk:"labels"` - Lite types.Bool `tfsdk:"lite"` - Name types.String `tfsdk:"name"` - Owner types.String `tfsdk:"owner"` - Page types.Int64 `tfsdk:"page"` - Pagination *tfTypes.PaginationEntity `tfsdk:"pagination"` - PerPage types.Int64 `tfsdk:"per_page"` - Query types.String `tfsdk:"query"` - RespondingTeams types.String `tfsdk:"responding_teams"` - Tiers types.String `tfsdk:"tiers"` -} - -// Metadata returns the data source type name. -func (r *ServicesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_services" -} - -// Schema defines the schema for the data source. -func (r *ServicesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Services DataSource", - - Attributes: map[string]schema.Attribute{ - "available_downstream_dependencies_for_id": schema.StringAttribute{ - Optional: true, - Description: `A query to find services that are available to be downstream dependencies for the passed service ID`, - }, - "available_upstream_dependencies_for_id": schema.StringAttribute{ - Optional: true, - Description: `A query to find services that are available to be upstream dependencies for the passed service ID`, - }, - "data": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "allowed_params": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "checklists": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "checks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "status": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of checklists associated with a service`, - }, - "completed_checks": schema.Int64Attribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - Description: `List of functionalities attached to the service`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "last_import": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "import_errors": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "data": schema.SingleNestedAttribute{ - Computed: true, - Description: `Additional error data`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "resource": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Computed: true, - }, - "resource_id": schema.StringAttribute{ - Computed: true, - }, - "resource_type": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "imported_at": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this service.`, - }, - "managed_by": schema.StringAttribute{ - Computed: true, - Description: `If set, this field indicates that the service is managed by an integration and thus cannot be set manually`, - }, - "managed_by_settings": schema.SingleNestedAttribute{ - Computed: true, - Description: `Indicates the settings of the catalog that manages this service`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `TeamEntity model`, - }, - "service_checklist_updated_at": schema.StringAttribute{ - Computed: true, - }, - "service_tier": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "teams": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of teams attached to the service`, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "functionalities": schema.StringAttribute{ - Optional: true, - Description: `A comma separated list of functionality ids`, - }, - "impacted": schema.StringAttribute{ - Optional: true, - Description: `A query to search services by if they are impacted with active incidents`, - }, - "include": schema.ListAttribute{ - Optional: true, - ElementType: types.StringType, - Description: `Use in conjunction with lite param to specify additional attributes to include`, - }, - "labels": schema.StringAttribute{ - Optional: true, - Description: `A comma separated list of label key / values in the format of 'key=value,key2=value2'. To filter change events that have a key (with no specific value), omit the value`, - }, - "lite": schema.BoolAttribute{ - Optional: true, - Description: `Boolean to determine whether to return a slimified version of the services object`, - }, - "name": schema.StringAttribute{ - Optional: true, - Description: `A query to search services by their name`, - }, - "owner": schema.StringAttribute{ - Optional: true, - Description: `A query to search services by their owner`, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "pagination": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "count": schema.Int64Attribute{ - Computed: true, - }, - "items": schema.Int64Attribute{ - Computed: true, - }, - "last": schema.Int64Attribute{ - Computed: true, - }, - "next": schema.Int64Attribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Computed: true, - }, - "pages": schema.Int64Attribute{ - Computed: true, - }, - "prev": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "query": schema.StringAttribute{ - Optional: true, - Description: `A query to search services by their name or description`, - }, - "responding_teams": schema.StringAttribute{ - Optional: true, - Description: `A comma separated list of team ids`, - }, - "tiers": schema.StringAttribute{ - Optional: true, - Description: `A query to search services by their tier`, - }, - }, - } -} - -func (r *ServicesDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *ServicesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *ServicesDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - labels := new(string) - if !data.Labels.IsUnknown() && !data.Labels.IsNull() { - *labels = data.Labels.ValueString() - } else { - labels = nil - } - query := new(string) - if !data.Query.IsUnknown() && !data.Query.IsNull() { - *query = data.Query.ValueString() - } else { - query = nil - } - name := new(string) - if !data.Name.IsUnknown() && !data.Name.IsNull() { - *name = data.Name.ValueString() - } else { - name = nil - } - tiers := new(string) - if !data.Tiers.IsUnknown() && !data.Tiers.IsNull() { - *tiers = data.Tiers.ValueString() - } else { - tiers = nil - } - impacted := new(string) - if !data.Impacted.IsUnknown() && !data.Impacted.IsNull() { - *impacted = data.Impacted.ValueString() - } else { - impacted = nil - } - owner := new(string) - if !data.Owner.IsUnknown() && !data.Owner.IsNull() { - *owner = data.Owner.ValueString() - } else { - owner = nil - } - respondingTeams := new(string) - if !data.RespondingTeams.IsUnknown() && !data.RespondingTeams.IsNull() { - *respondingTeams = data.RespondingTeams.ValueString() - } else { - respondingTeams = nil - } - functionalities := new(string) - if !data.Functionalities.IsUnknown() && !data.Functionalities.IsNull() { - *functionalities = data.Functionalities.ValueString() - } else { - functionalities = nil - } - availableDownstreamDependenciesForID := new(string) - if !data.AvailableDownstreamDependenciesForID.IsUnknown() && !data.AvailableDownstreamDependenciesForID.IsNull() { - *availableDownstreamDependenciesForID = data.AvailableDownstreamDependenciesForID.ValueString() - } else { - availableDownstreamDependenciesForID = nil - } - availableUpstreamDependenciesForID := new(string) - if !data.AvailableUpstreamDependenciesForID.IsUnknown() && !data.AvailableUpstreamDependenciesForID.IsNull() { - *availableUpstreamDependenciesForID = data.AvailableUpstreamDependenciesForID.ValueString() - } else { - availableUpstreamDependenciesForID = nil - } - lite := new(bool) - if !data.Lite.IsUnknown() && !data.Lite.IsNull() { - *lite = data.Lite.ValueBool() - } else { - lite = nil - } - var include []string = []string{} - for _, includeItem := range data.Include { - include = append(include, includeItem.ValueString()) - } - request := operations.GetV1ServicesRequest{ - Page: page, - PerPage: perPage, - Labels: labels, - Query: query, - Name: name, - Tiers: tiers, - Impacted: impacted, - Owner: owner, - RespondingTeams: respondingTeams, - Functionalities: functionalities, - AvailableDownstreamDependenciesForID: availableDownstreamDependenciesForID, - AvailableUpstreamDependenciesForID: availableUpstreamDependenciesForID, - Lite: lite, - Include: include, - } - res, err := r.client.Services.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.ServiceEntityPaginated != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedServiceEntityPaginated(res.ServiceEntityPaginated) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/services_data_source_sdk.go b/internal/provider/services_data_source_sdk.go deleted file mode 100644 index 143a492..0000000 --- a/internal/provider/services_data_source_sdk.go +++ /dev/null @@ -1,1596 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *ServicesDataSourceModel) RefreshFromSharedServiceEntityPaginated(resp *shared.ServiceEntityPaginated) { - if resp != nil { - r.Data = []tfTypes.ServiceEntity{} - if len(r.Data) > len(resp.Data) { - r.Data = r.Data[:len(resp.Data)] - } - for dataCount, dataItem := range resp.Data { - var data1 tfTypes.ServiceEntity - data1.ActiveIncidents = []types.String{} - for _, v := range dataItem.ActiveIncidents { - data1.ActiveIncidents = append(data1.ActiveIncidents, types.StringValue(v)) - } - data1.AlertOnAdd = types.BoolPointerValue(dataItem.AlertOnAdd) - data1.AllowedParams = []types.String{} - for _, v := range dataItem.AllowedParams { - data1.AllowedParams = append(data1.AllowedParams, types.StringValue(v)) - } - data1.AutoAddRespondingTeam = types.BoolPointerValue(dataItem.AutoAddRespondingTeam) - data1.Checklists = []tfTypes.Checklists{} - for checklistsCount, checklistsItem := range dataItem.Checklists { - var checklists1 tfTypes.Checklists - checklists1.Checks = []tfTypes.ChecklistCheckEntity{} - for checksCount, checksItem := range checklistsItem.Checks { - var checks1 tfTypes.ChecklistCheckEntity - checks1.Description = types.StringPointerValue(checksItem.Description) - checks1.ID = types.StringPointerValue(checksItem.ID) - checks1.Name = types.StringPointerValue(checksItem.Name) - checks1.Status = types.BoolPointerValue(checksItem.Status) - if checksCount+1 > len(checklists1.Checks) { - checklists1.Checks = append(checklists1.Checks, checks1) - } else { - checklists1.Checks[checksCount].Description = checks1.Description - checklists1.Checks[checksCount].ID = checks1.ID - checklists1.Checks[checksCount].Name = checks1.Name - checklists1.Checks[checksCount].Status = checks1.Status - } - } - checklists1.CreatedAt = types.StringPointerValue(checklistsItem.CreatedAt) - checklists1.Description = types.StringPointerValue(checklistsItem.Description) - checklists1.ID = types.StringPointerValue(checklistsItem.ID) - checklists1.Name = types.StringPointerValue(checklistsItem.Name) - if checklistsItem.Owner == nil { - checklists1.Owner = nil - } else { - checklists1.Owner = &tfTypes.TeamEntity{} - if checklistsItem.Owner.CreatedAt != nil { - checklists1.Owner.CreatedAt = types.StringValue(checklistsItem.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.CreatedAt = types.StringNull() - } - if checklistsItem.Owner.CreatedBy == nil { - checklists1.Owner.CreatedBy = nil - } else { - checklists1.Owner.CreatedBy = &tfTypes.AuthorEntity{} - checklists1.Owner.CreatedBy.Email = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Email) - checklists1.Owner.CreatedBy.ID = types.StringPointerValue(checklistsItem.Owner.CreatedBy.ID) - checklists1.Owner.CreatedBy.Name = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Name) - checklists1.Owner.CreatedBy.Source = types.StringPointerValue(checklistsItem.Owner.CreatedBy.Source) - } - checklists1.Owner.Description = types.StringPointerValue(checklistsItem.Owner.Description) - checklists1.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount, functionalitiesItem := range checklistsItem.Owner.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(checklists1.Owner.Functionalities) { - checklists1.Owner.Functionalities = append(checklists1.Owner.Functionalities, functionalities1) - } else { - checklists1.Owner.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - checklists1.Owner.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - checklists1.Owner.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - checklists1.Owner.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - checklists1.Owner.Functionalities[functionalitiesCount].Description = functionalities1.Description - checklists1.Owner.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - checklists1.Owner.Functionalities[functionalitiesCount].ID = functionalities1.ID - checklists1.Owner.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - checklists1.Owner.Functionalities[functionalitiesCount].Links = functionalities1.Links - checklists1.Owner.Functionalities[functionalitiesCount].Name = functionalities1.Name - checklists1.Owner.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - checklists1.Owner.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - checklists1.Owner.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - checklists1.Owner.ID = types.StringPointerValue(checklistsItem.Owner.ID) - checklists1.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range checklistsItem.Owner.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(checklists1.Owner.Memberships) { - checklists1.Owner.Memberships = append(checklists1.Owner.Memberships, memberships1) - } else { - checklists1.Owner.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - checklists1.Owner.Memberships[membershipsCount].Schedule = memberships1.Schedule - checklists1.Owner.Memberships[membershipsCount].User = memberships1.User - } - } - if checklistsItem.Owner.MsTeamsChannel == nil { - checklists1.Owner.MsTeamsChannel = nil - } else { - checklists1.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - checklists1.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelID) - checklists1.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelName) - checklists1.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ChannelURL) - checklists1.Owner.MsTeamsChannel.ID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.ID) - checklists1.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.MsTeamID) - checklists1.Owner.MsTeamsChannel.Status = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.Status) - checklists1.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(checklistsItem.Owner.MsTeamsChannel.TeamName) - } - checklists1.Owner.Name = types.StringPointerValue(checklistsItem.Owner.Name) - checklists1.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range checklistsItem.Owner.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(checklists1.Owner.OwnedFunctionalities) { - checklists1.Owner.OwnedFunctionalities = append(checklists1.Owner.OwnedFunctionalities, ownedFunctionalities1) - } else { - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - checklists1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - checklists1.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range checklistsItem.Owner.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(checklists1.Owner.OwnedRunbooks) { - checklists1.Owner.OwnedRunbooks = append(checklists1.Owner.OwnedRunbooks, ownedRunbooks1) - } else { - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - checklists1.Owner.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - checklists1.Owner.SignalsIcalURL = types.StringPointerValue(checklistsItem.Owner.SignalsIcalURL) - if checklistsItem.Owner.SlackChannel == nil { - checklists1.Owner.SlackChannel = nil - } else { - checklists1.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - checklists1.Owner.SlackChannel.ID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.ID) - checklists1.Owner.SlackChannel.Name = types.StringPointerValue(checklistsItem.Owner.SlackChannel.Name) - checklists1.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(checklistsItem.Owner.SlackChannel.SlackChannelID) - } - checklists1.Owner.Slug = types.StringPointerValue(checklistsItem.Owner.Slug) - if checklistsItem.Owner.UpdatedAt != nil { - checklists1.Owner.UpdatedAt = types.StringValue(checklistsItem.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.Owner.UpdatedAt = types.StringNull() - } - } - if checklistsItem.UpdatedAt != nil { - checklists1.UpdatedAt = types.StringValue(checklistsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - checklists1.UpdatedAt = types.StringNull() - } - if checklistsCount+1 > len(data1.Checklists) { - data1.Checklists = append(data1.Checklists, checklists1) - } else { - data1.Checklists[checklistsCount].Checks = checklists1.Checks - data1.Checklists[checklistsCount].CreatedAt = checklists1.CreatedAt - data1.Checklists[checklistsCount].Description = checklists1.Description - data1.Checklists[checklistsCount].ID = checklists1.ID - data1.Checklists[checklistsCount].Name = checklists1.Name - data1.Checklists[checklistsCount].Owner = checklists1.Owner - data1.Checklists[checklistsCount].UpdatedAt = checklists1.UpdatedAt - } - } - if dataItem.CompletedChecks != nil { - data1.CompletedChecks = types.Int64Value(int64(*dataItem.CompletedChecks)) - } else { - data1.CompletedChecks = types.Int64Null() - } - if dataItem.CreatedAt != nil { - data1.CreatedAt = types.StringValue(dataItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.CreatedAt = types.StringNull() - } - data1.Description = types.StringPointerValue(dataItem.Description) - data1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount2, externalResourcesItem2 := range dataItem.ExternalResources { - var externalResources5 tfTypes.ExternalResourceEntity - externalResources5.ConnectionID = types.StringPointerValue(externalResourcesItem2.ConnectionID) - externalResources5.ConnectionName = types.StringPointerValue(externalResourcesItem2.ConnectionName) - externalResources5.ConnectionType = types.StringPointerValue(externalResourcesItem2.ConnectionType) - if externalResourcesItem2.CreatedAt != nil { - externalResources5.CreatedAt = types.StringValue(externalResourcesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.CreatedAt = types.StringNull() - } - externalResources5.Name = types.StringPointerValue(externalResourcesItem2.Name) - externalResources5.RemoteID = types.StringPointerValue(externalResourcesItem2.RemoteID) - externalResources5.RemoteURL = types.StringPointerValue(externalResourcesItem2.RemoteURL) - if externalResourcesItem2.UpdatedAt != nil { - externalResources5.UpdatedAt = types.StringValue(externalResourcesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources5.UpdatedAt = types.StringNull() - } - if externalResourcesCount2+1 > len(data1.ExternalResources) { - data1.ExternalResources = append(data1.ExternalResources, externalResources5) - } else { - data1.ExternalResources[externalResourcesCount2].ConnectionID = externalResources5.ConnectionID - data1.ExternalResources[externalResourcesCount2].ConnectionName = externalResources5.ConnectionName - data1.ExternalResources[externalResourcesCount2].ConnectionType = externalResources5.ConnectionType - data1.ExternalResources[externalResourcesCount2].CreatedAt = externalResources5.CreatedAt - data1.ExternalResources[externalResourcesCount2].Name = externalResources5.Name - data1.ExternalResources[externalResourcesCount2].RemoteID = externalResources5.RemoteID - data1.ExternalResources[externalResourcesCount2].RemoteURL = externalResources5.RemoteURL - data1.ExternalResources[externalResourcesCount2].UpdatedAt = externalResources5.UpdatedAt - } - } - data1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount1, functionalitiesItem1 := range dataItem.Functionalities { - var functionalities3 tfTypes.FunctionalityEntity - functionalities3.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem1.ActiveIncidents { - functionalities3.ActiveIncidents = append(functionalities3.ActiveIncidents, types.StringValue(v)) - } - functionalities3.AlertOnAdd = types.BoolPointerValue(functionalitiesItem1.AlertOnAdd) - functionalities3.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem1.AutoAddRespondingTeam) - if functionalitiesItem1.CreatedAt != nil { - functionalities3.CreatedAt = types.StringValue(functionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.CreatedAt = types.StringNull() - } - functionalities3.Description = types.StringPointerValue(functionalitiesItem1.Description) - functionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount3, externalResourcesItem3 := range functionalitiesItem1.ExternalResources { - var externalResources7 tfTypes.ExternalResourceEntity - externalResources7.ConnectionID = types.StringPointerValue(externalResourcesItem3.ConnectionID) - externalResources7.ConnectionName = types.StringPointerValue(externalResourcesItem3.ConnectionName) - externalResources7.ConnectionType = types.StringPointerValue(externalResourcesItem3.ConnectionType) - if externalResourcesItem3.CreatedAt != nil { - externalResources7.CreatedAt = types.StringValue(externalResourcesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.CreatedAt = types.StringNull() - } - externalResources7.Name = types.StringPointerValue(externalResourcesItem3.Name) - externalResources7.RemoteID = types.StringPointerValue(externalResourcesItem3.RemoteID) - externalResources7.RemoteURL = types.StringPointerValue(externalResourcesItem3.RemoteURL) - if externalResourcesItem3.UpdatedAt != nil { - externalResources7.UpdatedAt = types.StringValue(externalResourcesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources7.UpdatedAt = types.StringNull() - } - if externalResourcesCount3+1 > len(functionalities3.ExternalResources) { - functionalities3.ExternalResources = append(functionalities3.ExternalResources, externalResources7) - } else { - functionalities3.ExternalResources[externalResourcesCount3].ConnectionID = externalResources7.ConnectionID - functionalities3.ExternalResources[externalResourcesCount3].ConnectionName = externalResources7.ConnectionName - functionalities3.ExternalResources[externalResourcesCount3].ConnectionType = externalResources7.ConnectionType - functionalities3.ExternalResources[externalResourcesCount3].CreatedAt = externalResources7.CreatedAt - functionalities3.ExternalResources[externalResourcesCount3].Name = externalResources7.Name - functionalities3.ExternalResources[externalResourcesCount3].RemoteID = externalResources7.RemoteID - functionalities3.ExternalResources[externalResourcesCount3].RemoteURL = externalResources7.RemoteURL - functionalities3.ExternalResources[externalResourcesCount3].UpdatedAt = externalResources7.UpdatedAt - } - } - functionalities3.ID = types.StringPointerValue(functionalitiesItem1.ID) - if len(functionalitiesItem1.Labels) > 0 { - functionalities3.Labels = make(map[string]types.String) - for key2, value3 := range functionalitiesItem1.Labels { - functionalities3.Labels[key2] = types.StringValue(value3) - } - } - functionalities3.Links = []tfTypes.LinksEntity{} - for linksCount2, linksItem2 := range functionalitiesItem1.Links { - var links5 tfTypes.LinksEntity - links5.HrefURL = types.StringPointerValue(linksItem2.HrefURL) - links5.IconURL = types.StringPointerValue(linksItem2.IconURL) - links5.ID = types.StringPointerValue(linksItem2.ID) - links5.Name = types.StringPointerValue(linksItem2.Name) - if linksCount2+1 > len(functionalities3.Links) { - functionalities3.Links = append(functionalities3.Links, links5) - } else { - functionalities3.Links[linksCount2].HrefURL = links5.HrefURL - functionalities3.Links[linksCount2].IconURL = links5.IconURL - functionalities3.Links[linksCount2].ID = links5.ID - functionalities3.Links[linksCount2].Name = links5.Name - } - } - functionalities3.Name = types.StringPointerValue(functionalitiesItem1.Name) - if functionalitiesItem1.Owner == nil { - functionalities3.Owner = nil - } else { - functionalities3.Owner = &tfTypes.TeamEntity1{} - } - functionalities3.Slug = types.StringPointerValue(functionalitiesItem1.Slug) - if functionalitiesItem1.UpdatedAt != nil { - functionalities3.UpdatedAt = types.StringValue(functionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities3.UpdatedAt = types.StringNull() - } - if functionalitiesItem1.UpdatedBy == nil { - functionalities3.UpdatedBy = nil - } else { - functionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities3.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Email) - functionalities3.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem1.UpdatedBy.ID) - functionalities3.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Name) - functionalities3.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem1.UpdatedBy.Source) - } - if functionalitiesCount1+1 > len(data1.Functionalities) { - data1.Functionalities = append(data1.Functionalities, functionalities3) - } else { - data1.Functionalities[functionalitiesCount1].ActiveIncidents = functionalities3.ActiveIncidents - data1.Functionalities[functionalitiesCount1].AlertOnAdd = functionalities3.AlertOnAdd - data1.Functionalities[functionalitiesCount1].AutoAddRespondingTeam = functionalities3.AutoAddRespondingTeam - data1.Functionalities[functionalitiesCount1].CreatedAt = functionalities3.CreatedAt - data1.Functionalities[functionalitiesCount1].Description = functionalities3.Description - data1.Functionalities[functionalitiesCount1].ExternalResources = functionalities3.ExternalResources - data1.Functionalities[functionalitiesCount1].ID = functionalities3.ID - data1.Functionalities[functionalitiesCount1].Labels = functionalities3.Labels - data1.Functionalities[functionalitiesCount1].Links = functionalities3.Links - data1.Functionalities[functionalitiesCount1].Name = functionalities3.Name - data1.Functionalities[functionalitiesCount1].Owner = functionalities3.Owner - data1.Functionalities[functionalitiesCount1].Slug = functionalities3.Slug - data1.Functionalities[functionalitiesCount1].UpdatedAt = functionalities3.UpdatedAt - data1.Functionalities[functionalitiesCount1].UpdatedBy = functionalities3.UpdatedBy - } - } - data1.ID = types.StringPointerValue(dataItem.ID) - if len(dataItem.Labels) > 0 { - data1.Labels = make(map[string]types.String) - for key3, value4 := range dataItem.Labels { - data1.Labels[key3] = types.StringValue(value4) - } - } - if dataItem.LastImport == nil { - data1.LastImport = nil - } else { - data1.LastImport = &tfTypes.ImportsImportableResourceEntity{} - data1.LastImport.ImportErrors = []tfTypes.ImportsImportErrorEntity{} - for importErrorsCount, importErrorsItem := range dataItem.LastImport.ImportErrors { - var importErrors1 tfTypes.ImportsImportErrorEntity - if importErrorsItem.CreatedAt != nil { - importErrors1.CreatedAt = types.StringValue(importErrorsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - importErrors1.CreatedAt = types.StringNull() - } - if importErrorsItem.Data == nil { - importErrors1.Data = nil - } else { - importErrors1.Data = &tfTypes.TeamEntity1{} - } - importErrors1.ID = types.StringPointerValue(importErrorsItem.ID) - importErrors1.Message = types.StringPointerValue(importErrorsItem.Message) - if importErrorsItem.Resource == nil { - importErrors1.Resource = nil - } else { - importErrors1.Resource = &tfTypes.ImportsImportErrorEntityResourceEntity{} - importErrors1.Resource.Name = types.StringPointerValue(importErrorsItem.Resource.Name) - importErrors1.Resource.ResourceID = types.StringPointerValue(importErrorsItem.Resource.ResourceID) - importErrors1.Resource.ResourceType = types.StringPointerValue(importErrorsItem.Resource.ResourceType) - } - if importErrorsCount+1 > len(data1.LastImport.ImportErrors) { - data1.LastImport.ImportErrors = append(data1.LastImport.ImportErrors, importErrors1) - } else { - data1.LastImport.ImportErrors[importErrorsCount].CreatedAt = importErrors1.CreatedAt - data1.LastImport.ImportErrors[importErrorsCount].Data = importErrors1.Data - data1.LastImport.ImportErrors[importErrorsCount].ID = importErrors1.ID - data1.LastImport.ImportErrors[importErrorsCount].Message = importErrors1.Message - data1.LastImport.ImportErrors[importErrorsCount].Resource = importErrors1.Resource - } - } - if dataItem.LastImport.ImportedAt != nil { - data1.LastImport.ImportedAt = types.StringValue(dataItem.LastImport.ImportedAt.Format(time.RFC3339Nano)) - } else { - data1.LastImport.ImportedAt = types.StringNull() - } - data1.LastImport.RemoteID = types.StringPointerValue(dataItem.LastImport.RemoteID) - if dataItem.LastImport.State != nil { - data1.LastImport.State = types.StringValue(string(*dataItem.LastImport.State)) - } else { - data1.LastImport.State = types.StringNull() - } - } - data1.Links = []tfTypes.LinksEntity{} - for linksCount3, linksItem3 := range dataItem.Links { - var links7 tfTypes.LinksEntity - links7.HrefURL = types.StringPointerValue(linksItem3.HrefURL) - links7.IconURL = types.StringPointerValue(linksItem3.IconURL) - links7.ID = types.StringPointerValue(linksItem3.ID) - links7.Name = types.StringPointerValue(linksItem3.Name) - if linksCount3+1 > len(data1.Links) { - data1.Links = append(data1.Links, links7) - } else { - data1.Links[linksCount3].HrefURL = links7.HrefURL - data1.Links[linksCount3].IconURL = links7.IconURL - data1.Links[linksCount3].ID = links7.ID - data1.Links[linksCount3].Name = links7.Name - } - } - data1.ManagedBy = types.StringPointerValue(dataItem.ManagedBy) - if dataItem.ManagedBySettings == nil { - data1.ManagedBySettings = nil - } else { - data1.ManagedBySettings = &tfTypes.TeamEntity1{} - } - data1.Name = types.StringPointerValue(dataItem.Name) - if dataItem.Owner == nil { - data1.Owner = nil - } else { - data1.Owner = &tfTypes.TeamEntity{} - if dataItem.Owner.CreatedAt != nil { - data1.Owner.CreatedAt = types.StringValue(dataItem.Owner.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.Owner.CreatedAt = types.StringNull() - } - if dataItem.Owner.CreatedBy == nil { - data1.Owner.CreatedBy = nil - } else { - data1.Owner.CreatedBy = &tfTypes.AuthorEntity{} - data1.Owner.CreatedBy.Email = types.StringPointerValue(dataItem.Owner.CreatedBy.Email) - data1.Owner.CreatedBy.ID = types.StringPointerValue(dataItem.Owner.CreatedBy.ID) - data1.Owner.CreatedBy.Name = types.StringPointerValue(dataItem.Owner.CreatedBy.Name) - data1.Owner.CreatedBy.Source = types.StringPointerValue(dataItem.Owner.CreatedBy.Source) - } - data1.Owner.Description = types.StringPointerValue(dataItem.Owner.Description) - data1.Owner.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount2, functionalitiesItem2 := range dataItem.Owner.Functionalities { - var functionalities5 tfTypes.FunctionalityEntity - functionalities5.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem2.ActiveIncidents { - functionalities5.ActiveIncidents = append(functionalities5.ActiveIncidents, types.StringValue(v)) - } - functionalities5.AlertOnAdd = types.BoolPointerValue(functionalitiesItem2.AlertOnAdd) - functionalities5.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem2.AutoAddRespondingTeam) - if functionalitiesItem2.CreatedAt != nil { - functionalities5.CreatedAt = types.StringValue(functionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.CreatedAt = types.StringNull() - } - functionalities5.Description = types.StringPointerValue(functionalitiesItem2.Description) - functionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount4, externalResourcesItem4 := range functionalitiesItem2.ExternalResources { - var externalResources9 tfTypes.ExternalResourceEntity - externalResources9.ConnectionID = types.StringPointerValue(externalResourcesItem4.ConnectionID) - externalResources9.ConnectionName = types.StringPointerValue(externalResourcesItem4.ConnectionName) - externalResources9.ConnectionType = types.StringPointerValue(externalResourcesItem4.ConnectionType) - if externalResourcesItem4.CreatedAt != nil { - externalResources9.CreatedAt = types.StringValue(externalResourcesItem4.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.CreatedAt = types.StringNull() - } - externalResources9.Name = types.StringPointerValue(externalResourcesItem4.Name) - externalResources9.RemoteID = types.StringPointerValue(externalResourcesItem4.RemoteID) - externalResources9.RemoteURL = types.StringPointerValue(externalResourcesItem4.RemoteURL) - if externalResourcesItem4.UpdatedAt != nil { - externalResources9.UpdatedAt = types.StringValue(externalResourcesItem4.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources9.UpdatedAt = types.StringNull() - } - if externalResourcesCount4+1 > len(functionalities5.ExternalResources) { - functionalities5.ExternalResources = append(functionalities5.ExternalResources, externalResources9) - } else { - functionalities5.ExternalResources[externalResourcesCount4].ConnectionID = externalResources9.ConnectionID - functionalities5.ExternalResources[externalResourcesCount4].ConnectionName = externalResources9.ConnectionName - functionalities5.ExternalResources[externalResourcesCount4].ConnectionType = externalResources9.ConnectionType - functionalities5.ExternalResources[externalResourcesCount4].CreatedAt = externalResources9.CreatedAt - functionalities5.ExternalResources[externalResourcesCount4].Name = externalResources9.Name - functionalities5.ExternalResources[externalResourcesCount4].RemoteID = externalResources9.RemoteID - functionalities5.ExternalResources[externalResourcesCount4].RemoteURL = externalResources9.RemoteURL - functionalities5.ExternalResources[externalResourcesCount4].UpdatedAt = externalResources9.UpdatedAt - } - } - functionalities5.ID = types.StringPointerValue(functionalitiesItem2.ID) - if len(functionalitiesItem2.Labels) > 0 { - functionalities5.Labels = make(map[string]types.String) - for key4, value5 := range functionalitiesItem2.Labels { - functionalities5.Labels[key4] = types.StringValue(value5) - } - } - functionalities5.Links = []tfTypes.LinksEntity{} - for linksCount4, linksItem4 := range functionalitiesItem2.Links { - var links9 tfTypes.LinksEntity - links9.HrefURL = types.StringPointerValue(linksItem4.HrefURL) - links9.IconURL = types.StringPointerValue(linksItem4.IconURL) - links9.ID = types.StringPointerValue(linksItem4.ID) - links9.Name = types.StringPointerValue(linksItem4.Name) - if linksCount4+1 > len(functionalities5.Links) { - functionalities5.Links = append(functionalities5.Links, links9) - } else { - functionalities5.Links[linksCount4].HrefURL = links9.HrefURL - functionalities5.Links[linksCount4].IconURL = links9.IconURL - functionalities5.Links[linksCount4].ID = links9.ID - functionalities5.Links[linksCount4].Name = links9.Name - } - } - functionalities5.Name = types.StringPointerValue(functionalitiesItem2.Name) - if functionalitiesItem2.Owner == nil { - functionalities5.Owner = nil - } else { - functionalities5.Owner = &tfTypes.TeamEntity1{} - } - functionalities5.Slug = types.StringPointerValue(functionalitiesItem2.Slug) - if functionalitiesItem2.UpdatedAt != nil { - functionalities5.UpdatedAt = types.StringValue(functionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities5.UpdatedAt = types.StringNull() - } - if functionalitiesItem2.UpdatedBy == nil { - functionalities5.UpdatedBy = nil - } else { - functionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities5.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Email) - functionalities5.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem2.UpdatedBy.ID) - functionalities5.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Name) - functionalities5.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem2.UpdatedBy.Source) - } - if functionalitiesCount2+1 > len(data1.Owner.Functionalities) { - data1.Owner.Functionalities = append(data1.Owner.Functionalities, functionalities5) - } else { - data1.Owner.Functionalities[functionalitiesCount2].ActiveIncidents = functionalities5.ActiveIncidents - data1.Owner.Functionalities[functionalitiesCount2].AlertOnAdd = functionalities5.AlertOnAdd - data1.Owner.Functionalities[functionalitiesCount2].AutoAddRespondingTeam = functionalities5.AutoAddRespondingTeam - data1.Owner.Functionalities[functionalitiesCount2].CreatedAt = functionalities5.CreatedAt - data1.Owner.Functionalities[functionalitiesCount2].Description = functionalities5.Description - data1.Owner.Functionalities[functionalitiesCount2].ExternalResources = functionalities5.ExternalResources - data1.Owner.Functionalities[functionalitiesCount2].ID = functionalities5.ID - data1.Owner.Functionalities[functionalitiesCount2].Labels = functionalities5.Labels - data1.Owner.Functionalities[functionalitiesCount2].Links = functionalities5.Links - data1.Owner.Functionalities[functionalitiesCount2].Name = functionalities5.Name - data1.Owner.Functionalities[functionalitiesCount2].Owner = functionalities5.Owner - data1.Owner.Functionalities[functionalitiesCount2].Slug = functionalities5.Slug - data1.Owner.Functionalities[functionalitiesCount2].UpdatedAt = functionalities5.UpdatedAt - data1.Owner.Functionalities[functionalitiesCount2].UpdatedBy = functionalities5.UpdatedBy - } - } - data1.Owner.ID = types.StringPointerValue(dataItem.Owner.ID) - data1.Owner.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount1, membershipsItem1 := range dataItem.Owner.Memberships { - var memberships3 tfTypes.MembershipEntity - if membershipsItem1.DefaultIncidentRole == nil { - memberships3.DefaultIncidentRole = nil - } else { - memberships3.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem1.DefaultIncidentRole.CreatedAt != nil { - memberships3.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Description) - if membershipsItem1.DefaultIncidentRole.DiscardedAt != nil { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships3.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.ID) - memberships3.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Name) - memberships3.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem1.DefaultIncidentRole.Summary) - if membershipsItem1.DefaultIncidentRole.UpdatedAt != nil { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem1.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem1.Schedule == nil { - memberships3.Schedule = nil - } else { - memberships3.Schedule = &tfTypes.ScheduleEntity{} - memberships3.Schedule.Discarded = types.BoolPointerValue(membershipsItem1.Schedule.Discarded) - memberships3.Schedule.ID = types.StringPointerValue(membershipsItem1.Schedule.ID) - memberships3.Schedule.Integration = types.StringPointerValue(membershipsItem1.Schedule.Integration) - memberships3.Schedule.Name = types.StringPointerValue(membershipsItem1.Schedule.Name) - } - if membershipsItem1.User == nil { - memberships3.User = nil - } else { - memberships3.User = &tfTypes.UserEntity{} - if membershipsItem1.User.CreatedAt != nil { - memberships3.User.CreatedAt = types.StringValue(membershipsItem1.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.CreatedAt = types.StringNull() - } - memberships3.User.Email = types.StringPointerValue(membershipsItem1.User.Email) - memberships3.User.ID = types.StringPointerValue(membershipsItem1.User.ID) - memberships3.User.Name = types.StringPointerValue(membershipsItem1.User.Name) - memberships3.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem1.User.SignalsEnabledNotificationTypes { - memberships3.User.SignalsEnabledNotificationTypes = append(memberships3.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships3.User.SlackLinked = types.BoolPointerValue(membershipsItem1.User.SlackLinked) - memberships3.User.SlackUserID = types.StringPointerValue(membershipsItem1.User.SlackUserID) - if membershipsItem1.User.UpdatedAt != nil { - memberships3.User.UpdatedAt = types.StringValue(membershipsItem1.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships3.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount1+1 > len(data1.Owner.Memberships) { - data1.Owner.Memberships = append(data1.Owner.Memberships, memberships3) - } else { - data1.Owner.Memberships[membershipsCount1].DefaultIncidentRole = memberships3.DefaultIncidentRole - data1.Owner.Memberships[membershipsCount1].Schedule = memberships3.Schedule - data1.Owner.Memberships[membershipsCount1].User = memberships3.User - } - } - if dataItem.Owner.MsTeamsChannel == nil { - data1.Owner.MsTeamsChannel = nil - } else { - data1.Owner.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - data1.Owner.MsTeamsChannel.ChannelID = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.ChannelID) - data1.Owner.MsTeamsChannel.ChannelName = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.ChannelName) - data1.Owner.MsTeamsChannel.ChannelURL = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.ChannelURL) - data1.Owner.MsTeamsChannel.ID = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.ID) - data1.Owner.MsTeamsChannel.MsTeamID = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.MsTeamID) - data1.Owner.MsTeamsChannel.Status = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.Status) - data1.Owner.MsTeamsChannel.TeamName = types.StringPointerValue(dataItem.Owner.MsTeamsChannel.TeamName) - } - data1.Owner.Name = types.StringPointerValue(dataItem.Owner.Name) - data1.Owner.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount1, ownedFunctionalitiesItem1 := range dataItem.Owner.OwnedFunctionalities { - var ownedFunctionalities3 tfTypes.FunctionalityEntity - ownedFunctionalities3.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem1.ActiveIncidents { - ownedFunctionalities3.ActiveIncidents = append(ownedFunctionalities3.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities3.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem1.AlertOnAdd) - ownedFunctionalities3.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem1.AutoAddRespondingTeam) - if ownedFunctionalitiesItem1.CreatedAt != nil { - ownedFunctionalities3.CreatedAt = types.StringValue(ownedFunctionalitiesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.CreatedAt = types.StringNull() - } - ownedFunctionalities3.Description = types.StringPointerValue(ownedFunctionalitiesItem1.Description) - ownedFunctionalities3.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount5, externalResourcesItem5 := range ownedFunctionalitiesItem1.ExternalResources { - var externalResources11 tfTypes.ExternalResourceEntity - externalResources11.ConnectionID = types.StringPointerValue(externalResourcesItem5.ConnectionID) - externalResources11.ConnectionName = types.StringPointerValue(externalResourcesItem5.ConnectionName) - externalResources11.ConnectionType = types.StringPointerValue(externalResourcesItem5.ConnectionType) - if externalResourcesItem5.CreatedAt != nil { - externalResources11.CreatedAt = types.StringValue(externalResourcesItem5.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.CreatedAt = types.StringNull() - } - externalResources11.Name = types.StringPointerValue(externalResourcesItem5.Name) - externalResources11.RemoteID = types.StringPointerValue(externalResourcesItem5.RemoteID) - externalResources11.RemoteURL = types.StringPointerValue(externalResourcesItem5.RemoteURL) - if externalResourcesItem5.UpdatedAt != nil { - externalResources11.UpdatedAt = types.StringValue(externalResourcesItem5.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources11.UpdatedAt = types.StringNull() - } - if externalResourcesCount5+1 > len(ownedFunctionalities3.ExternalResources) { - ownedFunctionalities3.ExternalResources = append(ownedFunctionalities3.ExternalResources, externalResources11) - } else { - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionID = externalResources11.ConnectionID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionName = externalResources11.ConnectionName - ownedFunctionalities3.ExternalResources[externalResourcesCount5].ConnectionType = externalResources11.ConnectionType - ownedFunctionalities3.ExternalResources[externalResourcesCount5].CreatedAt = externalResources11.CreatedAt - ownedFunctionalities3.ExternalResources[externalResourcesCount5].Name = externalResources11.Name - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteID = externalResources11.RemoteID - ownedFunctionalities3.ExternalResources[externalResourcesCount5].RemoteURL = externalResources11.RemoteURL - ownedFunctionalities3.ExternalResources[externalResourcesCount5].UpdatedAt = externalResources11.UpdatedAt - } - } - ownedFunctionalities3.ID = types.StringPointerValue(ownedFunctionalitiesItem1.ID) - if len(ownedFunctionalitiesItem1.Labels) > 0 { - ownedFunctionalities3.Labels = make(map[string]types.String) - for key5, value6 := range ownedFunctionalitiesItem1.Labels { - ownedFunctionalities3.Labels[key5] = types.StringValue(value6) - } - } - ownedFunctionalities3.Links = []tfTypes.LinksEntity{} - for linksCount5, linksItem5 := range ownedFunctionalitiesItem1.Links { - var links11 tfTypes.LinksEntity - links11.HrefURL = types.StringPointerValue(linksItem5.HrefURL) - links11.IconURL = types.StringPointerValue(linksItem5.IconURL) - links11.ID = types.StringPointerValue(linksItem5.ID) - links11.Name = types.StringPointerValue(linksItem5.Name) - if linksCount5+1 > len(ownedFunctionalities3.Links) { - ownedFunctionalities3.Links = append(ownedFunctionalities3.Links, links11) - } else { - ownedFunctionalities3.Links[linksCount5].HrefURL = links11.HrefURL - ownedFunctionalities3.Links[linksCount5].IconURL = links11.IconURL - ownedFunctionalities3.Links[linksCount5].ID = links11.ID - ownedFunctionalities3.Links[linksCount5].Name = links11.Name - } - } - ownedFunctionalities3.Name = types.StringPointerValue(ownedFunctionalitiesItem1.Name) - if ownedFunctionalitiesItem1.Owner == nil { - ownedFunctionalities3.Owner = nil - } else { - ownedFunctionalities3.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities3.Slug = types.StringPointerValue(ownedFunctionalitiesItem1.Slug) - if ownedFunctionalitiesItem1.UpdatedAt != nil { - ownedFunctionalities3.UpdatedAt = types.StringValue(ownedFunctionalitiesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities3.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem1.UpdatedBy == nil { - ownedFunctionalities3.UpdatedBy = nil - } else { - ownedFunctionalities3.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities3.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Email) - ownedFunctionalities3.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.ID) - ownedFunctionalities3.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Name) - ownedFunctionalities3.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem1.UpdatedBy.Source) - } - if ownedFunctionalitiesCount1+1 > len(data1.Owner.OwnedFunctionalities) { - data1.Owner.OwnedFunctionalities = append(data1.Owner.OwnedFunctionalities, ownedFunctionalities3) - } else { - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ActiveIncidents = ownedFunctionalities3.ActiveIncidents - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AlertOnAdd = ownedFunctionalities3.AlertOnAdd - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].AutoAddRespondingTeam = ownedFunctionalities3.AutoAddRespondingTeam - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].CreatedAt = ownedFunctionalities3.CreatedAt - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Description = ownedFunctionalities3.Description - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ExternalResources = ownedFunctionalities3.ExternalResources - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].ID = ownedFunctionalities3.ID - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Labels = ownedFunctionalities3.Labels - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Links = ownedFunctionalities3.Links - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Name = ownedFunctionalities3.Name - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Owner = ownedFunctionalities3.Owner - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].Slug = ownedFunctionalities3.Slug - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedAt = ownedFunctionalities3.UpdatedAt - data1.Owner.OwnedFunctionalities[ownedFunctionalitiesCount1].UpdatedBy = ownedFunctionalities3.UpdatedBy - } - } - data1.Owner.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount1, ownedRunbooksItem1 := range dataItem.Owner.OwnedRunbooks { - var ownedRunbooks3 tfTypes.SlimRunbookEntity - if ownedRunbooksItem1.AttachmentRule == nil { - ownedRunbooks3.AttachmentRule = nil - } else { - ownedRunbooks3.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem1.AttachmentRule.Logic == nil { - ownedRunbooks3.AttachmentRule.Logic = nil - } else { - ownedRunbooks3.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem1.AttachmentRule.UserData == nil { - ownedRunbooks3.AttachmentRule.UserData = nil - } else { - ownedRunbooks3.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks3.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Label) - ownedRunbooks3.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Type) - ownedRunbooks3.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem1.AttachmentRule.UserData.Value) - } - } - ownedRunbooks3.Categories = types.StringPointerValue(ownedRunbooksItem1.Categories) - if ownedRunbooksItem1.CreatedAt != nil { - ownedRunbooks3.CreatedAt = types.StringValue(ownedRunbooksItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.CreatedAt = types.StringNull() - } - ownedRunbooks3.Description = types.StringPointerValue(ownedRunbooksItem1.Description) - ownedRunbooks3.ID = types.StringPointerValue(ownedRunbooksItem1.ID) - ownedRunbooks3.Name = types.StringPointerValue(ownedRunbooksItem1.Name) - if ownedRunbooksItem1.Owner == nil { - ownedRunbooks3.Owner = nil - } else { - ownedRunbooks3.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks3.Summary = types.StringPointerValue(ownedRunbooksItem1.Summary) - ownedRunbooks3.Type = types.StringPointerValue(ownedRunbooksItem1.Type) - if ownedRunbooksItem1.UpdatedAt != nil { - ownedRunbooks3.UpdatedAt = types.StringValue(ownedRunbooksItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks3.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount1+1 > len(data1.Owner.OwnedRunbooks) { - data1.Owner.OwnedRunbooks = append(data1.Owner.OwnedRunbooks, ownedRunbooks3) - } else { - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].AttachmentRule = ownedRunbooks3.AttachmentRule - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].Categories = ownedRunbooks3.Categories - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].CreatedAt = ownedRunbooks3.CreatedAt - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].Description = ownedRunbooks3.Description - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].ID = ownedRunbooks3.ID - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].Name = ownedRunbooks3.Name - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].Owner = ownedRunbooks3.Owner - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].Summary = ownedRunbooks3.Summary - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].Type = ownedRunbooks3.Type - data1.Owner.OwnedRunbooks[ownedRunbooksCount1].UpdatedAt = ownedRunbooks3.UpdatedAt - } - } - data1.Owner.SignalsIcalURL = types.StringPointerValue(dataItem.Owner.SignalsIcalURL) - if dataItem.Owner.SlackChannel == nil { - data1.Owner.SlackChannel = nil - } else { - data1.Owner.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - data1.Owner.SlackChannel.ID = types.StringPointerValue(dataItem.Owner.SlackChannel.ID) - data1.Owner.SlackChannel.Name = types.StringPointerValue(dataItem.Owner.SlackChannel.Name) - data1.Owner.SlackChannel.SlackChannelID = types.StringPointerValue(dataItem.Owner.SlackChannel.SlackChannelID) - } - data1.Owner.Slug = types.StringPointerValue(dataItem.Owner.Slug) - if dataItem.Owner.UpdatedAt != nil { - data1.Owner.UpdatedAt = types.StringValue(dataItem.Owner.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.Owner.UpdatedAt = types.StringNull() - } - } - if dataItem.ServiceChecklistUpdatedAt != nil { - data1.ServiceChecklistUpdatedAt = types.StringValue(dataItem.ServiceChecklistUpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.ServiceChecklistUpdatedAt = types.StringNull() - } - if dataItem.ServiceTier != nil { - data1.ServiceTier = types.Int64Value(int64(*dataItem.ServiceTier)) - } else { - data1.ServiceTier = types.Int64Null() - } - data1.Slug = types.StringPointerValue(dataItem.Slug) - data1.Teams = []tfTypes.TeamEntity{} - for teamsCount, teamsItem := range dataItem.Teams { - var teams1 tfTypes.TeamEntity - if teamsItem.CreatedAt != nil { - teams1.CreatedAt = types.StringValue(teamsItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - teams1.CreatedAt = types.StringNull() - } - if teamsItem.CreatedBy == nil { - teams1.CreatedBy = nil - } else { - teams1.CreatedBy = &tfTypes.AuthorEntity{} - teams1.CreatedBy.Email = types.StringPointerValue(teamsItem.CreatedBy.Email) - teams1.CreatedBy.ID = types.StringPointerValue(teamsItem.CreatedBy.ID) - teams1.CreatedBy.Name = types.StringPointerValue(teamsItem.CreatedBy.Name) - teams1.CreatedBy.Source = types.StringPointerValue(teamsItem.CreatedBy.Source) - } - teams1.Description = types.StringPointerValue(teamsItem.Description) - teams1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount3, functionalitiesItem3 := range teamsItem.Functionalities { - var functionalities7 tfTypes.FunctionalityEntity - functionalities7.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem3.ActiveIncidents { - functionalities7.ActiveIncidents = append(functionalities7.ActiveIncidents, types.StringValue(v)) - } - functionalities7.AlertOnAdd = types.BoolPointerValue(functionalitiesItem3.AlertOnAdd) - functionalities7.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem3.AutoAddRespondingTeam) - if functionalitiesItem3.CreatedAt != nil { - functionalities7.CreatedAt = types.StringValue(functionalitiesItem3.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.CreatedAt = types.StringNull() - } - functionalities7.Description = types.StringPointerValue(functionalitiesItem3.Description) - functionalities7.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount6, externalResourcesItem6 := range functionalitiesItem3.ExternalResources { - var externalResources13 tfTypes.ExternalResourceEntity - externalResources13.ConnectionID = types.StringPointerValue(externalResourcesItem6.ConnectionID) - externalResources13.ConnectionName = types.StringPointerValue(externalResourcesItem6.ConnectionName) - externalResources13.ConnectionType = types.StringPointerValue(externalResourcesItem6.ConnectionType) - if externalResourcesItem6.CreatedAt != nil { - externalResources13.CreatedAt = types.StringValue(externalResourcesItem6.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.CreatedAt = types.StringNull() - } - externalResources13.Name = types.StringPointerValue(externalResourcesItem6.Name) - externalResources13.RemoteID = types.StringPointerValue(externalResourcesItem6.RemoteID) - externalResources13.RemoteURL = types.StringPointerValue(externalResourcesItem6.RemoteURL) - if externalResourcesItem6.UpdatedAt != nil { - externalResources13.UpdatedAt = types.StringValue(externalResourcesItem6.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources13.UpdatedAt = types.StringNull() - } - if externalResourcesCount6+1 > len(functionalities7.ExternalResources) { - functionalities7.ExternalResources = append(functionalities7.ExternalResources, externalResources13) - } else { - functionalities7.ExternalResources[externalResourcesCount6].ConnectionID = externalResources13.ConnectionID - functionalities7.ExternalResources[externalResourcesCount6].ConnectionName = externalResources13.ConnectionName - functionalities7.ExternalResources[externalResourcesCount6].ConnectionType = externalResources13.ConnectionType - functionalities7.ExternalResources[externalResourcesCount6].CreatedAt = externalResources13.CreatedAt - functionalities7.ExternalResources[externalResourcesCount6].Name = externalResources13.Name - functionalities7.ExternalResources[externalResourcesCount6].RemoteID = externalResources13.RemoteID - functionalities7.ExternalResources[externalResourcesCount6].RemoteURL = externalResources13.RemoteURL - functionalities7.ExternalResources[externalResourcesCount6].UpdatedAt = externalResources13.UpdatedAt - } - } - functionalities7.ID = types.StringPointerValue(functionalitiesItem3.ID) - if len(functionalitiesItem3.Labels) > 0 { - functionalities7.Labels = make(map[string]types.String) - for key6, value8 := range functionalitiesItem3.Labels { - functionalities7.Labels[key6] = types.StringValue(value8) - } - } - functionalities7.Links = []tfTypes.LinksEntity{} - for linksCount6, linksItem6 := range functionalitiesItem3.Links { - var links13 tfTypes.LinksEntity - links13.HrefURL = types.StringPointerValue(linksItem6.HrefURL) - links13.IconURL = types.StringPointerValue(linksItem6.IconURL) - links13.ID = types.StringPointerValue(linksItem6.ID) - links13.Name = types.StringPointerValue(linksItem6.Name) - if linksCount6+1 > len(functionalities7.Links) { - functionalities7.Links = append(functionalities7.Links, links13) - } else { - functionalities7.Links[linksCount6].HrefURL = links13.HrefURL - functionalities7.Links[linksCount6].IconURL = links13.IconURL - functionalities7.Links[linksCount6].ID = links13.ID - functionalities7.Links[linksCount6].Name = links13.Name - } - } - functionalities7.Name = types.StringPointerValue(functionalitiesItem3.Name) - if functionalitiesItem3.Owner == nil { - functionalities7.Owner = nil - } else { - functionalities7.Owner = &tfTypes.TeamEntity1{} - } - functionalities7.Slug = types.StringPointerValue(functionalitiesItem3.Slug) - if functionalitiesItem3.UpdatedAt != nil { - functionalities7.UpdatedAt = types.StringValue(functionalitiesItem3.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities7.UpdatedAt = types.StringNull() - } - if functionalitiesItem3.UpdatedBy == nil { - functionalities7.UpdatedBy = nil - } else { - functionalities7.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities7.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Email) - functionalities7.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem3.UpdatedBy.ID) - functionalities7.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Name) - functionalities7.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem3.UpdatedBy.Source) - } - if functionalitiesCount3+1 > len(teams1.Functionalities) { - teams1.Functionalities = append(teams1.Functionalities, functionalities7) - } else { - teams1.Functionalities[functionalitiesCount3].ActiveIncidents = functionalities7.ActiveIncidents - teams1.Functionalities[functionalitiesCount3].AlertOnAdd = functionalities7.AlertOnAdd - teams1.Functionalities[functionalitiesCount3].AutoAddRespondingTeam = functionalities7.AutoAddRespondingTeam - teams1.Functionalities[functionalitiesCount3].CreatedAt = functionalities7.CreatedAt - teams1.Functionalities[functionalitiesCount3].Description = functionalities7.Description - teams1.Functionalities[functionalitiesCount3].ExternalResources = functionalities7.ExternalResources - teams1.Functionalities[functionalitiesCount3].ID = functionalities7.ID - teams1.Functionalities[functionalitiesCount3].Labels = functionalities7.Labels - teams1.Functionalities[functionalitiesCount3].Links = functionalities7.Links - teams1.Functionalities[functionalitiesCount3].Name = functionalities7.Name - teams1.Functionalities[functionalitiesCount3].Owner = functionalities7.Owner - teams1.Functionalities[functionalitiesCount3].Slug = functionalities7.Slug - teams1.Functionalities[functionalitiesCount3].UpdatedAt = functionalities7.UpdatedAt - teams1.Functionalities[functionalitiesCount3].UpdatedBy = functionalities7.UpdatedBy - } - } - teams1.ID = types.StringPointerValue(teamsItem.ID) - teams1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount2, membershipsItem2 := range teamsItem.Memberships { - var memberships5 tfTypes.MembershipEntity - if membershipsItem2.DefaultIncidentRole == nil { - memberships5.DefaultIncidentRole = nil - } else { - memberships5.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem2.DefaultIncidentRole.CreatedAt != nil { - memberships5.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Description) - if membershipsItem2.DefaultIncidentRole.DiscardedAt != nil { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships5.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.ID) - memberships5.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Name) - memberships5.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem2.DefaultIncidentRole.Summary) - if membershipsItem2.DefaultIncidentRole.UpdatedAt != nil { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem2.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem2.Schedule == nil { - memberships5.Schedule = nil - } else { - memberships5.Schedule = &tfTypes.ScheduleEntity{} - memberships5.Schedule.Discarded = types.BoolPointerValue(membershipsItem2.Schedule.Discarded) - memberships5.Schedule.ID = types.StringPointerValue(membershipsItem2.Schedule.ID) - memberships5.Schedule.Integration = types.StringPointerValue(membershipsItem2.Schedule.Integration) - memberships5.Schedule.Name = types.StringPointerValue(membershipsItem2.Schedule.Name) - } - if membershipsItem2.User == nil { - memberships5.User = nil - } else { - memberships5.User = &tfTypes.UserEntity{} - if membershipsItem2.User.CreatedAt != nil { - memberships5.User.CreatedAt = types.StringValue(membershipsItem2.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.CreatedAt = types.StringNull() - } - memberships5.User.Email = types.StringPointerValue(membershipsItem2.User.Email) - memberships5.User.ID = types.StringPointerValue(membershipsItem2.User.ID) - memberships5.User.Name = types.StringPointerValue(membershipsItem2.User.Name) - memberships5.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem2.User.SignalsEnabledNotificationTypes { - memberships5.User.SignalsEnabledNotificationTypes = append(memberships5.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships5.User.SlackLinked = types.BoolPointerValue(membershipsItem2.User.SlackLinked) - memberships5.User.SlackUserID = types.StringPointerValue(membershipsItem2.User.SlackUserID) - if membershipsItem2.User.UpdatedAt != nil { - memberships5.User.UpdatedAt = types.StringValue(membershipsItem2.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships5.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount2+1 > len(teams1.Memberships) { - teams1.Memberships = append(teams1.Memberships, memberships5) - } else { - teams1.Memberships[membershipsCount2].DefaultIncidentRole = memberships5.DefaultIncidentRole - teams1.Memberships[membershipsCount2].Schedule = memberships5.Schedule - teams1.Memberships[membershipsCount2].User = memberships5.User - } - } - if teamsItem.MsTeamsChannel == nil { - teams1.MsTeamsChannel = nil - } else { - teams1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - teams1.MsTeamsChannel.ChannelID = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelID) - teams1.MsTeamsChannel.ChannelName = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelName) - teams1.MsTeamsChannel.ChannelURL = types.StringPointerValue(teamsItem.MsTeamsChannel.ChannelURL) - teams1.MsTeamsChannel.ID = types.StringPointerValue(teamsItem.MsTeamsChannel.ID) - teams1.MsTeamsChannel.MsTeamID = types.StringPointerValue(teamsItem.MsTeamsChannel.MsTeamID) - teams1.MsTeamsChannel.Status = types.StringPointerValue(teamsItem.MsTeamsChannel.Status) - teams1.MsTeamsChannel.TeamName = types.StringPointerValue(teamsItem.MsTeamsChannel.TeamName) - } - teams1.Name = types.StringPointerValue(teamsItem.Name) - teams1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount2, ownedFunctionalitiesItem2 := range teamsItem.OwnedFunctionalities { - var ownedFunctionalities5 tfTypes.FunctionalityEntity - ownedFunctionalities5.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem2.ActiveIncidents { - ownedFunctionalities5.ActiveIncidents = append(ownedFunctionalities5.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities5.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem2.AlertOnAdd) - ownedFunctionalities5.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem2.AutoAddRespondingTeam) - if ownedFunctionalitiesItem2.CreatedAt != nil { - ownedFunctionalities5.CreatedAt = types.StringValue(ownedFunctionalitiesItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.CreatedAt = types.StringNull() - } - ownedFunctionalities5.Description = types.StringPointerValue(ownedFunctionalitiesItem2.Description) - ownedFunctionalities5.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount7, externalResourcesItem7 := range ownedFunctionalitiesItem2.ExternalResources { - var externalResources15 tfTypes.ExternalResourceEntity - externalResources15.ConnectionID = types.StringPointerValue(externalResourcesItem7.ConnectionID) - externalResources15.ConnectionName = types.StringPointerValue(externalResourcesItem7.ConnectionName) - externalResources15.ConnectionType = types.StringPointerValue(externalResourcesItem7.ConnectionType) - if externalResourcesItem7.CreatedAt != nil { - externalResources15.CreatedAt = types.StringValue(externalResourcesItem7.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.CreatedAt = types.StringNull() - } - externalResources15.Name = types.StringPointerValue(externalResourcesItem7.Name) - externalResources15.RemoteID = types.StringPointerValue(externalResourcesItem7.RemoteID) - externalResources15.RemoteURL = types.StringPointerValue(externalResourcesItem7.RemoteURL) - if externalResourcesItem7.UpdatedAt != nil { - externalResources15.UpdatedAt = types.StringValue(externalResourcesItem7.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources15.UpdatedAt = types.StringNull() - } - if externalResourcesCount7+1 > len(ownedFunctionalities5.ExternalResources) { - ownedFunctionalities5.ExternalResources = append(ownedFunctionalities5.ExternalResources, externalResources15) - } else { - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionID = externalResources15.ConnectionID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionName = externalResources15.ConnectionName - ownedFunctionalities5.ExternalResources[externalResourcesCount7].ConnectionType = externalResources15.ConnectionType - ownedFunctionalities5.ExternalResources[externalResourcesCount7].CreatedAt = externalResources15.CreatedAt - ownedFunctionalities5.ExternalResources[externalResourcesCount7].Name = externalResources15.Name - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteID = externalResources15.RemoteID - ownedFunctionalities5.ExternalResources[externalResourcesCount7].RemoteURL = externalResources15.RemoteURL - ownedFunctionalities5.ExternalResources[externalResourcesCount7].UpdatedAt = externalResources15.UpdatedAt - } - } - ownedFunctionalities5.ID = types.StringPointerValue(ownedFunctionalitiesItem2.ID) - if len(ownedFunctionalitiesItem2.Labels) > 0 { - ownedFunctionalities5.Labels = make(map[string]types.String) - for key7, value9 := range ownedFunctionalitiesItem2.Labels { - ownedFunctionalities5.Labels[key7] = types.StringValue(value9) - } - } - ownedFunctionalities5.Links = []tfTypes.LinksEntity{} - for linksCount7, linksItem7 := range ownedFunctionalitiesItem2.Links { - var links15 tfTypes.LinksEntity - links15.HrefURL = types.StringPointerValue(linksItem7.HrefURL) - links15.IconURL = types.StringPointerValue(linksItem7.IconURL) - links15.ID = types.StringPointerValue(linksItem7.ID) - links15.Name = types.StringPointerValue(linksItem7.Name) - if linksCount7+1 > len(ownedFunctionalities5.Links) { - ownedFunctionalities5.Links = append(ownedFunctionalities5.Links, links15) - } else { - ownedFunctionalities5.Links[linksCount7].HrefURL = links15.HrefURL - ownedFunctionalities5.Links[linksCount7].IconURL = links15.IconURL - ownedFunctionalities5.Links[linksCount7].ID = links15.ID - ownedFunctionalities5.Links[linksCount7].Name = links15.Name - } - } - ownedFunctionalities5.Name = types.StringPointerValue(ownedFunctionalitiesItem2.Name) - if ownedFunctionalitiesItem2.Owner == nil { - ownedFunctionalities5.Owner = nil - } else { - ownedFunctionalities5.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities5.Slug = types.StringPointerValue(ownedFunctionalitiesItem2.Slug) - if ownedFunctionalitiesItem2.UpdatedAt != nil { - ownedFunctionalities5.UpdatedAt = types.StringValue(ownedFunctionalitiesItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities5.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem2.UpdatedBy == nil { - ownedFunctionalities5.UpdatedBy = nil - } else { - ownedFunctionalities5.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities5.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Email) - ownedFunctionalities5.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.ID) - ownedFunctionalities5.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Name) - ownedFunctionalities5.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem2.UpdatedBy.Source) - } - if ownedFunctionalitiesCount2+1 > len(teams1.OwnedFunctionalities) { - teams1.OwnedFunctionalities = append(teams1.OwnedFunctionalities, ownedFunctionalities5) - } else { - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ActiveIncidents = ownedFunctionalities5.ActiveIncidents - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AlertOnAdd = ownedFunctionalities5.AlertOnAdd - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].AutoAddRespondingTeam = ownedFunctionalities5.AutoAddRespondingTeam - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].CreatedAt = ownedFunctionalities5.CreatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Description = ownedFunctionalities5.Description - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ExternalResources = ownedFunctionalities5.ExternalResources - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].ID = ownedFunctionalities5.ID - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Labels = ownedFunctionalities5.Labels - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Links = ownedFunctionalities5.Links - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Name = ownedFunctionalities5.Name - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Owner = ownedFunctionalities5.Owner - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].Slug = ownedFunctionalities5.Slug - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedAt = ownedFunctionalities5.UpdatedAt - teams1.OwnedFunctionalities[ownedFunctionalitiesCount2].UpdatedBy = ownedFunctionalities5.UpdatedBy - } - } - teams1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount2, ownedRunbooksItem2 := range teamsItem.OwnedRunbooks { - var ownedRunbooks5 tfTypes.SlimRunbookEntity - if ownedRunbooksItem2.AttachmentRule == nil { - ownedRunbooks5.AttachmentRule = nil - } else { - ownedRunbooks5.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem2.AttachmentRule.Logic == nil { - ownedRunbooks5.AttachmentRule.Logic = nil - } else { - ownedRunbooks5.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem2.AttachmentRule.UserData == nil { - ownedRunbooks5.AttachmentRule.UserData = nil - } else { - ownedRunbooks5.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks5.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Label) - ownedRunbooks5.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Type) - ownedRunbooks5.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem2.AttachmentRule.UserData.Value) - } - } - ownedRunbooks5.Categories = types.StringPointerValue(ownedRunbooksItem2.Categories) - if ownedRunbooksItem2.CreatedAt != nil { - ownedRunbooks5.CreatedAt = types.StringValue(ownedRunbooksItem2.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.CreatedAt = types.StringNull() - } - ownedRunbooks5.Description = types.StringPointerValue(ownedRunbooksItem2.Description) - ownedRunbooks5.ID = types.StringPointerValue(ownedRunbooksItem2.ID) - ownedRunbooks5.Name = types.StringPointerValue(ownedRunbooksItem2.Name) - if ownedRunbooksItem2.Owner == nil { - ownedRunbooks5.Owner = nil - } else { - ownedRunbooks5.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks5.Summary = types.StringPointerValue(ownedRunbooksItem2.Summary) - ownedRunbooks5.Type = types.StringPointerValue(ownedRunbooksItem2.Type) - if ownedRunbooksItem2.UpdatedAt != nil { - ownedRunbooks5.UpdatedAt = types.StringValue(ownedRunbooksItem2.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks5.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount2+1 > len(teams1.OwnedRunbooks) { - teams1.OwnedRunbooks = append(teams1.OwnedRunbooks, ownedRunbooks5) - } else { - teams1.OwnedRunbooks[ownedRunbooksCount2].AttachmentRule = ownedRunbooks5.AttachmentRule - teams1.OwnedRunbooks[ownedRunbooksCount2].Categories = ownedRunbooks5.Categories - teams1.OwnedRunbooks[ownedRunbooksCount2].CreatedAt = ownedRunbooks5.CreatedAt - teams1.OwnedRunbooks[ownedRunbooksCount2].Description = ownedRunbooks5.Description - teams1.OwnedRunbooks[ownedRunbooksCount2].ID = ownedRunbooks5.ID - teams1.OwnedRunbooks[ownedRunbooksCount2].Name = ownedRunbooks5.Name - teams1.OwnedRunbooks[ownedRunbooksCount2].Owner = ownedRunbooks5.Owner - teams1.OwnedRunbooks[ownedRunbooksCount2].Summary = ownedRunbooks5.Summary - teams1.OwnedRunbooks[ownedRunbooksCount2].Type = ownedRunbooks5.Type - teams1.OwnedRunbooks[ownedRunbooksCount2].UpdatedAt = ownedRunbooks5.UpdatedAt - } - } - teams1.SignalsIcalURL = types.StringPointerValue(teamsItem.SignalsIcalURL) - if teamsItem.SlackChannel == nil { - teams1.SlackChannel = nil - } else { - teams1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - teams1.SlackChannel.ID = types.StringPointerValue(teamsItem.SlackChannel.ID) - teams1.SlackChannel.Name = types.StringPointerValue(teamsItem.SlackChannel.Name) - teams1.SlackChannel.SlackChannelID = types.StringPointerValue(teamsItem.SlackChannel.SlackChannelID) - } - teams1.Slug = types.StringPointerValue(teamsItem.Slug) - if teamsItem.UpdatedAt != nil { - teams1.UpdatedAt = types.StringValue(teamsItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - teams1.UpdatedAt = types.StringNull() - } - if teamsCount+1 > len(data1.Teams) { - data1.Teams = append(data1.Teams, teams1) - } else { - data1.Teams[teamsCount].CreatedAt = teams1.CreatedAt - data1.Teams[teamsCount].CreatedBy = teams1.CreatedBy - data1.Teams[teamsCount].Description = teams1.Description - data1.Teams[teamsCount].Functionalities = teams1.Functionalities - data1.Teams[teamsCount].ID = teams1.ID - data1.Teams[teamsCount].Memberships = teams1.Memberships - data1.Teams[teamsCount].MsTeamsChannel = teams1.MsTeamsChannel - data1.Teams[teamsCount].Name = teams1.Name - data1.Teams[teamsCount].OwnedFunctionalities = teams1.OwnedFunctionalities - data1.Teams[teamsCount].OwnedRunbooks = teams1.OwnedRunbooks - data1.Teams[teamsCount].SignalsIcalURL = teams1.SignalsIcalURL - data1.Teams[teamsCount].SlackChannel = teams1.SlackChannel - data1.Teams[teamsCount].Slug = teams1.Slug - data1.Teams[teamsCount].UpdatedAt = teams1.UpdatedAt - } - } - if dataItem.UpdatedAt != nil { - data1.UpdatedAt = types.StringValue(dataItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.UpdatedAt = types.StringNull() - } - if dataItem.UpdatedBy == nil { - data1.UpdatedBy = nil - } else { - data1.UpdatedBy = &tfTypes.AuthorEntity{} - data1.UpdatedBy.Email = types.StringPointerValue(dataItem.UpdatedBy.Email) - data1.UpdatedBy.ID = types.StringPointerValue(dataItem.UpdatedBy.ID) - data1.UpdatedBy.Name = types.StringPointerValue(dataItem.UpdatedBy.Name) - data1.UpdatedBy.Source = types.StringPointerValue(dataItem.UpdatedBy.Source) - } - if dataCount+1 > len(r.Data) { - r.Data = append(r.Data, data1) - } else { - r.Data[dataCount].ActiveIncidents = data1.ActiveIncidents - r.Data[dataCount].AlertOnAdd = data1.AlertOnAdd - r.Data[dataCount].AllowedParams = data1.AllowedParams - r.Data[dataCount].AutoAddRespondingTeam = data1.AutoAddRespondingTeam - r.Data[dataCount].Checklists = data1.Checklists - r.Data[dataCount].CompletedChecks = data1.CompletedChecks - r.Data[dataCount].CreatedAt = data1.CreatedAt - r.Data[dataCount].Description = data1.Description - r.Data[dataCount].ExternalResources = data1.ExternalResources - r.Data[dataCount].Functionalities = data1.Functionalities - r.Data[dataCount].ID = data1.ID - r.Data[dataCount].Labels = data1.Labels - r.Data[dataCount].LastImport = data1.LastImport - r.Data[dataCount].Links = data1.Links - r.Data[dataCount].ManagedBy = data1.ManagedBy - r.Data[dataCount].ManagedBySettings = data1.ManagedBySettings - r.Data[dataCount].Name = data1.Name - r.Data[dataCount].Owner = data1.Owner - r.Data[dataCount].ServiceChecklistUpdatedAt = data1.ServiceChecklistUpdatedAt - r.Data[dataCount].ServiceTier = data1.ServiceTier - r.Data[dataCount].Slug = data1.Slug - r.Data[dataCount].Teams = data1.Teams - r.Data[dataCount].UpdatedAt = data1.UpdatedAt - r.Data[dataCount].UpdatedBy = data1.UpdatedBy - } - } - if resp.Pagination == nil { - r.Pagination = nil - } else { - r.Pagination = &tfTypes.PaginationEntity{} - if resp.Pagination.Count != nil { - r.Pagination.Count = types.Int64Value(int64(*resp.Pagination.Count)) - } else { - r.Pagination.Count = types.Int64Null() - } - if resp.Pagination.Items != nil { - r.Pagination.Items = types.Int64Value(int64(*resp.Pagination.Items)) - } else { - r.Pagination.Items = types.Int64Null() - } - if resp.Pagination.Last != nil { - r.Pagination.Last = types.Int64Value(int64(*resp.Pagination.Last)) - } else { - r.Pagination.Last = types.Int64Null() - } - if resp.Pagination.Next != nil { - r.Pagination.Next = types.Int64Value(int64(*resp.Pagination.Next)) - } else { - r.Pagination.Next = types.Int64Null() - } - if resp.Pagination.Page != nil { - r.Pagination.Page = types.Int64Value(int64(*resp.Pagination.Page)) - } else { - r.Pagination.Page = types.Int64Null() - } - if resp.Pagination.Pages != nil { - r.Pagination.Pages = types.Int64Value(int64(*resp.Pagination.Pages)) - } else { - r.Pagination.Pages = types.Int64Null() - } - if resp.Pagination.Prev != nil { - r.Pagination.Prev = types.Int64Value(int64(*resp.Pagination.Prev)) - } else { - r.Pagination.Prev = types.Int64Null() - } - } - } -} diff --git a/internal/provider/severities_data_source.go b/internal/provider/severities_data_source.go deleted file mode 100644 index 7ebc75d..0000000 --- a/internal/provider/severities_data_source.go +++ /dev/null @@ -1,198 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &SeveritiesDataSource{} -var _ datasource.DataSourceWithConfigure = &SeveritiesDataSource{} - -func NewSeveritiesDataSource() datasource.DataSource { - return &SeveritiesDataSource{} -} - -// SeveritiesDataSource is the data source implementation. -type SeveritiesDataSource struct { - client *sdk.Firehydrant -} - -// SeveritiesDataSourceModel describes the data model. -type SeveritiesDataSourceModel struct { - Data []tfTypes.SeverityEntity `tfsdk:"data"` - Page types.Int64 `tfsdk:"page"` - Pagination *tfTypes.PaginationEntity `tfsdk:"pagination"` - PerPage types.Int64 `tfsdk:"per_page"` -} - -// Metadata returns the data source type name. -func (r *SeveritiesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_severities" -} - -// Schema defines the schema for the data source. -func (r *SeveritiesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Severities DataSource", - - Attributes: map[string]schema.Attribute{ - "data": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "color": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "position": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "system_record": schema.BoolAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "pagination": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "count": schema.Int64Attribute{ - Computed: true, - }, - "items": schema.Int64Attribute{ - Computed: true, - }, - "last": schema.Int64Attribute{ - Computed: true, - }, - "next": schema.Int64Attribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Computed: true, - }, - "pages": schema.Int64Attribute{ - Computed: true, - }, - "prev": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - }, - } -} - -func (r *SeveritiesDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *SeveritiesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *SeveritiesDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - request := operations.GetV1SeveritiesRequest{ - Page: page, - PerPage: perPage, - } - res, err := r.client.Severities.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.SeverityEntityPaginated != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedSeverityEntityPaginated(res.SeverityEntityPaginated) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/severities_data_source_sdk.go b/internal/provider/severities_data_source_sdk.go deleted file mode 100644 index 1428345..0000000 --- a/internal/provider/severities_data_source_sdk.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *SeveritiesDataSourceModel) RefreshFromSharedSeverityEntityPaginated(resp *shared.SeverityEntityPaginated) { - if resp != nil { - r.Data = []tfTypes.SeverityEntity{} - if len(r.Data) > len(resp.Data) { - r.Data = r.Data[:len(resp.Data)] - } - for dataCount, dataItem := range resp.Data { - var data1 tfTypes.SeverityEntity - data1.Color = types.StringPointerValue(dataItem.Color) - if dataItem.CreatedAt != nil { - data1.CreatedAt = types.StringValue(dataItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.CreatedAt = types.StringNull() - } - data1.Description = types.StringPointerValue(dataItem.Description) - if dataItem.Position != nil { - data1.Position = types.Int64Value(int64(*dataItem.Position)) - } else { - data1.Position = types.Int64Null() - } - data1.Slug = types.StringPointerValue(dataItem.Slug) - data1.SystemRecord = types.BoolPointerValue(dataItem.SystemRecord) - data1.Type = types.StringPointerValue(dataItem.Type) - if dataItem.UpdatedAt != nil { - data1.UpdatedAt = types.StringValue(dataItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.UpdatedAt = types.StringNull() - } - if dataCount+1 > len(r.Data) { - r.Data = append(r.Data, data1) - } else { - r.Data[dataCount].Color = data1.Color - r.Data[dataCount].CreatedAt = data1.CreatedAt - r.Data[dataCount].Description = data1.Description - r.Data[dataCount].Position = data1.Position - r.Data[dataCount].Slug = data1.Slug - r.Data[dataCount].SystemRecord = data1.SystemRecord - r.Data[dataCount].Type = data1.Type - r.Data[dataCount].UpdatedAt = data1.UpdatedAt - } - } - if resp.Pagination == nil { - r.Pagination = nil - } else { - r.Pagination = &tfTypes.PaginationEntity{} - if resp.Pagination.Count != nil { - r.Pagination.Count = types.Int64Value(int64(*resp.Pagination.Count)) - } else { - r.Pagination.Count = types.Int64Null() - } - if resp.Pagination.Items != nil { - r.Pagination.Items = types.Int64Value(int64(*resp.Pagination.Items)) - } else { - r.Pagination.Items = types.Int64Null() - } - if resp.Pagination.Last != nil { - r.Pagination.Last = types.Int64Value(int64(*resp.Pagination.Last)) - } else { - r.Pagination.Last = types.Int64Null() - } - if resp.Pagination.Next != nil { - r.Pagination.Next = types.Int64Value(int64(*resp.Pagination.Next)) - } else { - r.Pagination.Next = types.Int64Null() - } - if resp.Pagination.Page != nil { - r.Pagination.Page = types.Int64Value(int64(*resp.Pagination.Page)) - } else { - r.Pagination.Page = types.Int64Null() - } - if resp.Pagination.Pages != nil { - r.Pagination.Pages = types.Int64Value(int64(*resp.Pagination.Pages)) - } else { - r.Pagination.Pages = types.Int64Null() - } - if resp.Pagination.Prev != nil { - r.Pagination.Prev = types.Int64Value(int64(*resp.Pagination.Prev)) - } else { - r.Pagination.Prev = types.Int64Null() - } - } - } -} diff --git a/internal/provider/severity_data_source.go b/internal/provider/severity_data_source.go deleted file mode 100644 index 68fc5b8..0000000 --- a/internal/provider/severity_data_source.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &SeverityDataSource{} -var _ datasource.DataSourceWithConfigure = &SeverityDataSource{} - -func NewSeverityDataSource() datasource.DataSource { - return &SeverityDataSource{} -} - -// SeverityDataSource is the data source implementation. -type SeverityDataSource struct { - client *sdk.Firehydrant -} - -// SeverityDataSourceModel describes the data model. -type SeverityDataSourceModel struct { - Color types.String `tfsdk:"color"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - Position types.Int64 `tfsdk:"position"` - Slug types.String `tfsdk:"slug"` - SystemRecord types.Bool `tfsdk:"system_record"` - Type types.String `tfsdk:"type"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *SeverityDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_severity" -} - -// Schema defines the schema for the data source. -func (r *SeverityDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Severity DataSource", - - Attributes: map[string]schema.Attribute{ - "color": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "position": schema.Int64Attribute{ - Computed: true, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "system_record": schema.BoolAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *SeverityDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *SeverityDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *SeverityDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var severitySlug string - severitySlug = data.Slug.ValueString() - - request := operations.GetV1SeveritiesSeveritySlugRequest{ - SeveritySlug: severitySlug, - } - res, err := r.client.Severities.Retrieve(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.SeverityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedSeverityEntity(res.SeverityEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/severity_data_source_sdk.go b/internal/provider/severity_data_source_sdk.go deleted file mode 100644 index e756dec..0000000 --- a/internal/provider/severity_data_source_sdk.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *SeverityDataSourceModel) RefreshFromSharedSeverityEntity(resp *shared.SeverityEntity) { - if resp != nil { - r.Color = types.StringPointerValue(resp.Color) - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.Description = types.StringPointerValue(resp.Description) - if resp.Position != nil { - r.Position = types.Int64Value(int64(*resp.Position)) - } else { - r.Position = types.Int64Null() - } - r.Slug = types.StringPointerValue(resp.Slug) - r.SystemRecord = types.BoolPointerValue(resp.SystemRecord) - r.Type = types.StringPointerValue(resp.Type) - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} diff --git a/internal/provider/severity_resource.go b/internal/provider/severity_resource.go deleted file mode 100644 index d2a2ae8..0000000 --- a/internal/provider/severity_resource.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &SeverityResource{} -var _ resource.ResourceWithImportState = &SeverityResource{} - -func NewSeverityResource() resource.Resource { - return &SeverityResource{} -} - -// SeverityResource defines the resource implementation. -type SeverityResource struct { - client *sdk.Firehydrant -} - -// SeverityResourceModel describes the resource data model. -type SeverityResourceModel struct { - Color types.String `tfsdk:"color"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - Position types.Int64 `tfsdk:"position"` - Slug types.String `tfsdk:"slug"` - SystemRecord types.Bool `tfsdk:"system_record"` - Type types.String `tfsdk:"type"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *SeverityResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_severity" -} - -func (r *SeverityResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Severity Resource", - Attributes: map[string]schema.Attribute{ - "color": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `must be one of ["red", "orange", "yellow", "blue", "teal", "grey"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "red", - "orange", - "yellow", - "blue", - "teal", - "grey", - ), - }, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "position": schema.Int64Attribute{ - Computed: true, - Optional: true, - }, - "slug": schema.StringAttribute{ - Required: true, - }, - "system_record": schema.BoolAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *SeverityResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *SeverityResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *SeverityResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1Severities() - res, err := r.client.Severities.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.SeverityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedSeverityEntity(res.SeverityEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *SeverityResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *SeverityResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var severitySlug string - severitySlug = data.Slug.ValueString() - - request := operations.GetV1SeveritiesSeveritySlugRequest{ - SeveritySlug: severitySlug, - } - res, err := r.client.Severities.Retrieve(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.SeverityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedSeverityEntity(res.SeverityEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *SeverityResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *SeverityResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var severitySlug string - severitySlug = data.Slug.ValueString() - - patchV1SeveritiesSeveritySlug := *data.ToSharedPatchV1SeveritiesSeveritySlug() - request := operations.PatchV1SeveritiesSeveritySlugRequest{ - SeveritySlug: severitySlug, - PatchV1SeveritiesSeveritySlug: patchV1SeveritiesSeveritySlug, - } - res, err := r.client.Severities.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.SeverityEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedSeverityEntity(res.SeverityEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *SeverityResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *SeverityResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var severitySlug string - severitySlug = data.Slug.ValueString() - - request := operations.DeleteV1SeveritiesSeveritySlugRequest{ - SeveritySlug: severitySlug, - } - res, err := r.client.Severities.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *SeverityResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("slug"), req.ID)...) -} diff --git a/internal/provider/severity_resource_sdk.go b/internal/provider/severity_resource_sdk.go deleted file mode 100644 index b11ec0b..0000000 --- a/internal/provider/severity_resource_sdk.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *SeverityResourceModel) ToSharedPostV1Severities() *shared.PostV1Severities { - var slug string - slug = r.Slug.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - position := new(int) - if !r.Position.IsUnknown() && !r.Position.IsNull() { - *position = int(r.Position.ValueInt64()) - } else { - position = nil - } - color := new(shared.Color) - if !r.Color.IsUnknown() && !r.Color.IsNull() { - *color = shared.Color(r.Color.ValueString()) - } else { - color = nil - } - out := shared.PostV1Severities{ - Slug: slug, - Description: description, - Position: position, - Color: color, - } - return &out -} - -func (r *SeverityResourceModel) RefreshFromSharedSeverityEntity(resp *shared.SeverityEntity) { - if resp != nil { - if resp.Color != nil { - r.Color = types.StringValue(string(*resp.Color)) - } else { - r.Color = types.StringNull() - } - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - r.Description = types.StringPointerValue(resp.Description) - if resp.Position != nil { - r.Position = types.Int64Value(int64(*resp.Position)) - } else { - r.Position = types.Int64Null() - } - r.Slug = types.StringPointerValue(resp.Slug) - r.SystemRecord = types.BoolPointerValue(resp.SystemRecord) - r.Type = types.StringPointerValue(resp.Type) - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} - -func (r *SeverityResourceModel) ToSharedPatchV1SeveritiesSeveritySlug() *shared.PatchV1SeveritiesSeveritySlug { - slug := new(string) - if !r.Slug.IsUnknown() && !r.Slug.IsNull() { - *slug = r.Slug.ValueString() - } else { - slug = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - position := new(int) - if !r.Position.IsUnknown() && !r.Position.IsNull() { - *position = int(r.Position.ValueInt64()) - } else { - position = nil - } - color := new(shared.PatchV1SeveritiesSeveritySlugColor) - if !r.Color.IsUnknown() && !r.Color.IsNull() { - *color = shared.PatchV1SeveritiesSeveritySlugColor(r.Color.ValueString()) - } else { - color = nil - } - out := shared.PatchV1SeveritiesSeveritySlug{ - Slug: slug, - Description: description, - Position: position, - Color: color, - } - return &out -} diff --git a/internal/provider/statusupdatetemplate_data_source.go b/internal/provider/statusupdatetemplate_data_source.go deleted file mode 100644 index facffa8..0000000 --- a/internal/provider/statusupdatetemplate_data_source.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &StatusUpdateTemplateDataSource{} -var _ datasource.DataSourceWithConfigure = &StatusUpdateTemplateDataSource{} - -func NewStatusUpdateTemplateDataSource() datasource.DataSource { - return &StatusUpdateTemplateDataSource{} -} - -// StatusUpdateTemplateDataSource is the data source implementation. -type StatusUpdateTemplateDataSource struct { - client *sdk.Firehydrant -} - -// StatusUpdateTemplateDataSourceModel describes the data model. -type StatusUpdateTemplateDataSourceModel struct { - Body types.String `tfsdk:"body"` - CreatedAt types.String `tfsdk:"created_at"` - DiscardedAt types.String `tfsdk:"discarded_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *StatusUpdateTemplateDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_status_update_template" -} - -// Schema defines the schema for the data source. -func (r *StatusUpdateTemplateDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "StatusUpdateTemplate DataSource", - - Attributes: map[string]schema.Attribute{ - "body": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *StatusUpdateTemplateDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *StatusUpdateTemplateDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *StatusUpdateTemplateDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var statusUpdateTemplateID string - statusUpdateTemplateID = data.ID.ValueString() - - request := operations.GetV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest{ - StatusUpdateTemplateID: statusUpdateTemplateID, - } - res, err := r.client.StatusUpdateTemplates.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/statusupdatetemplate_data_source_sdk.go b/internal/provider/statusupdatetemplate_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/statusupdatetemplate_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/statusupdatetemplate_resource.go b/internal/provider/statusupdatetemplate_resource.go deleted file mode 100644 index 6968a77..0000000 --- a/internal/provider/statusupdatetemplate_resource.go +++ /dev/null @@ -1,280 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &StatusUpdateTemplateResource{} -var _ resource.ResourceWithImportState = &StatusUpdateTemplateResource{} - -func NewStatusUpdateTemplateResource() resource.Resource { - return &StatusUpdateTemplateResource{} -} - -// StatusUpdateTemplateResource defines the resource implementation. -type StatusUpdateTemplateResource struct { - client *sdk.Firehydrant -} - -// StatusUpdateTemplateResourceModel describes the resource data model. -type StatusUpdateTemplateResourceModel struct { - Body types.String `tfsdk:"body"` - CreatedAt types.String `tfsdk:"created_at"` - DiscardedAt types.String `tfsdk:"discarded_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *StatusUpdateTemplateResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_status_update_template" -} - -func (r *StatusUpdateTemplateResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "StatusUpdateTemplate Resource", - Attributes: map[string]schema.Attribute{ - "body": schema.StringAttribute{ - Required: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *StatusUpdateTemplateResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *StatusUpdateTemplateResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *StatusUpdateTemplateResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1StatusUpdateTemplates() - res, err := r.client.StatusUpdateTemplates.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *StatusUpdateTemplateResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *StatusUpdateTemplateResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var statusUpdateTemplateID string - statusUpdateTemplateID = data.ID.ValueString() - - request := operations.GetV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest{ - StatusUpdateTemplateID: statusUpdateTemplateID, - } - res, err := r.client.StatusUpdateTemplates.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *StatusUpdateTemplateResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *StatusUpdateTemplateResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var statusUpdateTemplateID string - statusUpdateTemplateID = data.ID.ValueString() - - patchV1StatusUpdateTemplatesStatusUpdateTemplateID := *data.ToSharedPatchV1StatusUpdateTemplatesStatusUpdateTemplateID() - request := operations.PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest{ - StatusUpdateTemplateID: statusUpdateTemplateID, - PatchV1StatusUpdateTemplatesStatusUpdateTemplateID: patchV1StatusUpdateTemplatesStatusUpdateTemplateID, - } - res, err := r.client.StatusUpdateTemplates.Patch(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *StatusUpdateTemplateResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *StatusUpdateTemplateResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var statusUpdateTemplateID string - statusUpdateTemplateID = data.ID.ValueString() - - request := operations.DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest{ - StatusUpdateTemplateID: statusUpdateTemplateID, - } - res, err := r.client.StatusUpdateTemplates.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *StatusUpdateTemplateResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/statusupdatetemplate_resource_sdk.go b/internal/provider/statusupdatetemplate_resource_sdk.go deleted file mode 100644 index 1d1653a..0000000 --- a/internal/provider/statusupdatetemplate_resource_sdk.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" -) - -func (r *StatusUpdateTemplateResourceModel) ToSharedPostV1StatusUpdateTemplates() *shared.PostV1StatusUpdateTemplates { - var name string - name = r.Name.ValueString() - - var body string - body = r.Body.ValueString() - - out := shared.PostV1StatusUpdateTemplates{ - Name: name, - Body: body, - } - return &out -} - -func (r *StatusUpdateTemplateResourceModel) ToSharedPatchV1StatusUpdateTemplatesStatusUpdateTemplateID() *shared.PatchV1StatusUpdateTemplatesStatusUpdateTemplateID { - name := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name = r.Name.ValueString() - } else { - name = nil - } - body := new(string) - if !r.Body.IsUnknown() && !r.Body.IsNull() { - *body = r.Body.ValueString() - } else { - body = nil - } - out := shared.PatchV1StatusUpdateTemplatesStatusUpdateTemplateID{ - Name: name, - Body: body, - } - return &out -} diff --git a/internal/provider/statusupdatetemplates_data_source.go b/internal/provider/statusupdatetemplates_data_source.go deleted file mode 100644 index 4af808d..0000000 --- a/internal/provider/statusupdatetemplates_data_source.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &StatusUpdateTemplatesDataSource{} -var _ datasource.DataSourceWithConfigure = &StatusUpdateTemplatesDataSource{} - -func NewStatusUpdateTemplatesDataSource() datasource.DataSource { - return &StatusUpdateTemplatesDataSource{} -} - -// StatusUpdateTemplatesDataSource is the data source implementation. -type StatusUpdateTemplatesDataSource struct { - client *sdk.Firehydrant -} - -// StatusUpdateTemplatesDataSourceModel describes the data model. -type StatusUpdateTemplatesDataSourceModel struct { - Body types.String `tfsdk:"body"` - CreatedAt types.String `tfsdk:"created_at"` - DiscardedAt types.String `tfsdk:"discarded_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Page types.Int64 `tfsdk:"page"` - PerPage types.Int64 `tfsdk:"per_page"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *StatusUpdateTemplatesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_status_update_templates" -} - -// Schema defines the schema for the data source. -func (r *StatusUpdateTemplatesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "StatusUpdateTemplates DataSource", - - Attributes: map[string]schema.Attribute{ - "body": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *StatusUpdateTemplatesDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *StatusUpdateTemplatesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *StatusUpdateTemplatesDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - request := operations.GetV1StatusUpdateTemplatesRequest{ - Page: page, - PerPage: perPage, - } - res, err := r.client.StatusUpdateTemplates.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/statusupdatetemplates_data_source_sdk.go b/internal/provider/statusupdatetemplates_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/statusupdatetemplates_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/tasklist_data_source.go b/internal/provider/tasklist_data_source.go deleted file mode 100644 index b27d704..0000000 --- a/internal/provider/tasklist_data_source.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &TaskListDataSource{} -var _ datasource.DataSourceWithConfigure = &TaskListDataSource{} - -func NewTaskListDataSource() datasource.DataSource { - return &TaskListDataSource{} -} - -// TaskListDataSource is the data source implementation. -type TaskListDataSource struct { - client *sdk.Firehydrant -} - -// TaskListDataSourceModel describes the data model. -type TaskListDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - Email types.String `tfsdk:"email"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Source types.String `tfsdk:"source"` - Summary types.String `tfsdk:"summary"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *TaskListDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_task_list" -} - -// Schema defines the schema for the data source. -func (r *TaskListDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "TaskList DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *TaskListDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *TaskListDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *TaskListDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var taskListID string - taskListID = data.ID.ValueString() - - request := operations.GetV1TaskListsTaskListIDRequest{ - TaskListID: taskListID, - } - res, err := r.client.TaskLists.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/tasklist_data_source_sdk.go b/internal/provider/tasklist_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/tasklist_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/tasklist_resource.go b/internal/provider/tasklist_resource.go deleted file mode 100644 index 2e1f0b5..0000000 --- a/internal/provider/tasklist_resource.go +++ /dev/null @@ -1,303 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &TaskListResource{} -var _ resource.ResourceWithImportState = &TaskListResource{} - -func NewTaskListResource() resource.Resource { - return &TaskListResource{} -} - -// TaskListResource defines the resource implementation. -type TaskListResource struct { - client *sdk.Firehydrant -} - -// TaskListResourceModel describes the resource data model. -type TaskListResourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - Email types.String `tfsdk:"email"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Source types.String `tfsdk:"source"` - Summary types.String `tfsdk:"summary"` - TaskListItems []tfTypes.TaskListItems `tfsdk:"task_list_items"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *TaskListResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_task_list" -} - -func (r *TaskListResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "TaskList Resource", - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "task_list_items": schema.ListNestedAttribute{ - Required: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "description": schema.StringAttribute{ - Optional: true, - Description: `A long-form description for the task if additional context is helpful`, - }, - "summary": schema.StringAttribute{ - Required: true, - Description: `A summary of the task`, - }, - }, - }, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *TaskListResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *TaskListResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *TaskListResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1TaskLists() - res, err := r.client.TaskLists.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *TaskListResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *TaskListResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var taskListID string - taskListID = data.ID.ValueString() - - request := operations.GetV1TaskListsTaskListIDRequest{ - TaskListID: taskListID, - } - res, err := r.client.TaskLists.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *TaskListResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *TaskListResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var taskListID string - taskListID = data.ID.ValueString() - - patchV1TaskListsTaskListID := *data.ToSharedPatchV1TaskListsTaskListID() - request := operations.PatchV1TaskListsTaskListIDRequest{ - TaskListID: taskListID, - PatchV1TaskListsTaskListID: patchV1TaskListsTaskListID, - } - res, err := r.client.TaskLists.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *TaskListResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *TaskListResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var taskListID string - taskListID = data.ID.ValueString() - - request := operations.DeleteV1TaskListsTaskListIDRequest{ - TaskListID: taskListID, - } - res, err := r.client.TaskLists.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *TaskListResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/tasklist_resource_sdk.go b/internal/provider/tasklist_resource_sdk.go deleted file mode 100644 index 85c9663..0000000 --- a/internal/provider/tasklist_resource_sdk.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" -) - -func (r *TaskListResourceModel) ToSharedPostV1TaskLists() *shared.PostV1TaskLists { - var name string - name = r.Name.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - var taskListItems []shared.TaskListItems = []shared.TaskListItems{} - for _, taskListItemsItem := range r.TaskListItems { - var summary string - summary = taskListItemsItem.Summary.ValueString() - - description1 := new(string) - if !taskListItemsItem.Description.IsUnknown() && !taskListItemsItem.Description.IsNull() { - *description1 = taskListItemsItem.Description.ValueString() - } else { - description1 = nil - } - taskListItems = append(taskListItems, shared.TaskListItems{ - Summary: summary, - Description: description1, - }) - } - out := shared.PostV1TaskLists{ - Name: name, - Description: description, - TaskListItems: taskListItems, - } - return &out -} - -func (r *TaskListResourceModel) ToSharedPatchV1TaskListsTaskListID() *shared.PatchV1TaskListsTaskListID { - name := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name = r.Name.ValueString() - } else { - name = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - var taskListItems []shared.PatchV1TaskListsTaskListIDTaskListItems = []shared.PatchV1TaskListsTaskListIDTaskListItems{} - for _, taskListItemsItem := range r.TaskListItems { - var summary string - summary = taskListItemsItem.Summary.ValueString() - - description1 := new(string) - if !taskListItemsItem.Description.IsUnknown() && !taskListItemsItem.Description.IsNull() { - *description1 = taskListItemsItem.Description.ValueString() - } else { - description1 = nil - } - taskListItems = append(taskListItems, shared.PatchV1TaskListsTaskListIDTaskListItems{ - Summary: summary, - Description: description1, - }) - } - out := shared.PatchV1TaskListsTaskListID{ - Name: name, - Description: description, - TaskListItems: taskListItems, - } - return &out -} diff --git a/internal/provider/tasklists_data_source.go b/internal/provider/tasklists_data_source.go deleted file mode 100644 index 0ec93d4..0000000 --- a/internal/provider/tasklists_data_source.go +++ /dev/null @@ -1,165 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &TaskListsDataSource{} -var _ datasource.DataSourceWithConfigure = &TaskListsDataSource{} - -func NewTaskListsDataSource() datasource.DataSource { - return &TaskListsDataSource{} -} - -// TaskListsDataSource is the data source implementation. -type TaskListsDataSource struct { - client *sdk.Firehydrant -} - -// TaskListsDataSourceModel describes the data model. -type TaskListsDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - Email types.String `tfsdk:"email"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Page types.Int64 `tfsdk:"page"` - PerPage types.Int64 `tfsdk:"per_page"` - Source types.String `tfsdk:"source"` - Summary types.String `tfsdk:"summary"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *TaskListsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_task_lists" -} - -// Schema defines the schema for the data source. -func (r *TaskListsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "TaskLists DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *TaskListsDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *TaskListsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *TaskListsDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - request := operations.GetV1TaskListsRequest{ - Page: page, - PerPage: perPage, - } - res, err := r.client.TaskLists.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/tasklists_data_source_sdk.go b/internal/provider/tasklists_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/tasklists_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/team_data_source.go b/internal/provider/team_data_source.go deleted file mode 100644 index ad1a1d5..0000000 --- a/internal/provider/team_data_source.go +++ /dev/null @@ -1,593 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &TeamDataSource{} -var _ datasource.DataSourceWithConfigure = &TeamDataSource{} - -func NewTeamDataSource() datasource.DataSource { - return &TeamDataSource{} -} - -// TeamDataSource is the data source implementation. -type TeamDataSource struct { - client *sdk.Firehydrant -} - -// TeamDataSourceModel describes the data model. -type TeamDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - CreatedBy *tfTypes.AuthorEntity `tfsdk:"created_by"` - Description types.String `tfsdk:"description"` - Functionalities []tfTypes.FunctionalityEntity `tfsdk:"functionalities"` - ID types.String `tfsdk:"id"` - Lite types.Bool `tfsdk:"lite"` - Memberships []tfTypes.MembershipEntity `tfsdk:"memberships"` - MsTeamsChannel *tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity `tfsdk:"ms_teams_channel"` - Name types.String `tfsdk:"name"` - OwnedFunctionalities []tfTypes.FunctionalityEntity `tfsdk:"owned_functionalities"` - OwnedRunbooks []tfTypes.SlimRunbookEntity `tfsdk:"owned_runbooks"` - SignalsIcalURL types.String `tfsdk:"signals_ical_url"` - SlackChannel *tfTypes.IntegrationsSlackSlackChannelEntity `tfsdk:"slack_channel"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -// Metadata returns the data source type name. -func (r *TeamDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_team" -} - -// Schema defines the schema for the data source. -func (r *TeamDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Team DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "lite": schema.BoolAttribute{ - Optional: true, - Description: `Boolean to determine whether to return a slimified version of the teams object`, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *TeamDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *TeamDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *TeamDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var teamID string - teamID = data.ID.ValueString() - - lite := new(bool) - if !data.Lite.IsUnknown() && !data.Lite.IsNull() { - *lite = data.Lite.ValueBool() - } else { - lite = nil - } - request := operations.GetV1TeamsTeamIDRequest{ - TeamID: teamID, - Lite: lite, - } - res, err := r.client.Teams.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.TeamEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedTeamEntity(res.TeamEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/team_data_source_sdk.go b/internal/provider/team_data_source_sdk.go deleted file mode 100644 index 22352b6..0000000 --- a/internal/provider/team_data_source_sdk.go +++ /dev/null @@ -1,416 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *TeamDataSourceModel) RefreshFromSharedTeamEntity(resp *shared.TeamEntity) { - if resp != nil { - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - if resp.CreatedBy == nil { - r.CreatedBy = nil - } else { - r.CreatedBy = &tfTypes.AuthorEntity{} - r.CreatedBy.Email = types.StringPointerValue(resp.CreatedBy.Email) - r.CreatedBy.ID = types.StringPointerValue(resp.CreatedBy.ID) - r.CreatedBy.Name = types.StringPointerValue(resp.CreatedBy.Name) - r.CreatedBy.Source = types.StringPointerValue(resp.CreatedBy.Source) - } - r.Description = types.StringPointerValue(resp.Description) - r.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Functionalities) > len(resp.Functionalities) { - r.Functionalities = r.Functionalities[:len(resp.Functionalities)] - } - for functionalitiesCount, functionalitiesItem := range resp.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(r.Functionalities) { - r.Functionalities = append(r.Functionalities, functionalities1) - } else { - r.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - r.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - r.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - r.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - r.Functionalities[functionalitiesCount].Description = functionalities1.Description - r.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - r.Functionalities[functionalitiesCount].ID = functionalities1.ID - r.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - r.Functionalities[functionalitiesCount].Links = functionalities1.Links - r.Functionalities[functionalitiesCount].Name = functionalities1.Name - r.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - r.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - r.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - r.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - r.ID = types.StringPointerValue(resp.ID) - r.Memberships = []tfTypes.MembershipEntity{} - if len(r.Memberships) > len(resp.Memberships) { - r.Memberships = r.Memberships[:len(resp.Memberships)] - } - for membershipsCount, membershipsItem := range resp.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(r.Memberships) { - r.Memberships = append(r.Memberships, memberships1) - } else { - r.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - r.Memberships[membershipsCount].Schedule = memberships1.Schedule - r.Memberships[membershipsCount].User = memberships1.User - } - } - if resp.MsTeamsChannel == nil { - r.MsTeamsChannel = nil - } else { - r.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - r.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.MsTeamsChannel.ChannelID) - r.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.MsTeamsChannel.ChannelName) - r.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.MsTeamsChannel.ChannelURL) - r.MsTeamsChannel.ID = types.StringPointerValue(resp.MsTeamsChannel.ID) - r.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.MsTeamsChannel.MsTeamID) - r.MsTeamsChannel.Status = types.StringPointerValue(resp.MsTeamsChannel.Status) - r.MsTeamsChannel.TeamName = types.StringPointerValue(resp.MsTeamsChannel.TeamName) - } - r.Name = types.StringPointerValue(resp.Name) - r.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.OwnedFunctionalities) > len(resp.OwnedFunctionalities) { - r.OwnedFunctionalities = r.OwnedFunctionalities[:len(resp.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range resp.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(r.OwnedFunctionalities) { - r.OwnedFunctionalities = append(r.OwnedFunctionalities, ownedFunctionalities1) - } else { - r.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - r.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - r.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - r.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - r.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - r.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - r.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - r.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - r.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - r.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - r.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - r.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - r.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - r.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - r.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.OwnedRunbooks) > len(resp.OwnedRunbooks) { - r.OwnedRunbooks = r.OwnedRunbooks[:len(resp.OwnedRunbooks)] - } - for ownedRunbooksCount, ownedRunbooksItem := range resp.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(r.OwnedRunbooks) { - r.OwnedRunbooks = append(r.OwnedRunbooks, ownedRunbooks1) - } else { - r.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - r.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - r.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - r.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - r.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - r.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - r.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - r.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - r.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - r.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - r.SignalsIcalURL = types.StringPointerValue(resp.SignalsIcalURL) - if resp.SlackChannel == nil { - r.SlackChannel = nil - } else { - r.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.SlackChannel.ID = types.StringPointerValue(resp.SlackChannel.ID) - r.SlackChannel.Name = types.StringPointerValue(resp.SlackChannel.Name) - r.SlackChannel.SlackChannelID = types.StringPointerValue(resp.SlackChannel.SlackChannelID) - } - r.Slug = types.StringPointerValue(resp.Slug) - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} diff --git a/internal/provider/team_resource.go b/internal/provider/team_resource.go deleted file mode 100644 index 2c4dc0a..0000000 --- a/internal/provider/team_resource.go +++ /dev/null @@ -1,877 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - speakeasy_objectvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/objectvalidators" - speakeasy_stringvalidators "github.com/firehydrant/terraform-provider-firehydrant/internal/validators/stringvalidators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &TeamResource{} -var _ resource.ResourceWithImportState = &TeamResource{} - -func NewTeamResource() resource.Resource { - return &TeamResource{} -} - -// TeamResource defines the resource implementation. -type TeamResource struct { - client *sdk.Firehydrant -} - -// TeamResourceModel describes the resource data model. -type TeamResourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - CreatedBy *tfTypes.AuthorEntity `tfsdk:"created_by"` - Description types.String `tfsdk:"description"` - Functionalities []tfTypes.FunctionalityEntity `tfsdk:"functionalities"` - ID types.String `tfsdk:"id"` - Memberships []tfTypes.Memberships `tfsdk:"memberships"` - MsTeamsChannel *tfTypes.MsTeamsChannel `tfsdk:"ms_teams_channel"` - Name types.String `tfsdk:"name"` - OwnedFunctionalities []tfTypes.FunctionalityEntity `tfsdk:"owned_functionalities"` - OwnedRunbooks []tfTypes.SlimRunbookEntity `tfsdk:"owned_runbooks"` - SignalsIcalURL types.String `tfsdk:"signals_ical_url"` - SlackChannel *tfTypes.IntegrationsSlackSlackChannelEntity `tfsdk:"slack_channel"` - SlackChannelID types.String `tfsdk:"slack_channel_id"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} - -func (r *TeamResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_team" -} - -func (r *TeamResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Team Resource", - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "incident_role_id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `An incident role ID that this user will automatically assigned if this team is assigned to an incident`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "schedule_id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - "user_id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `MS Teams channel identity for channel associated with this team`, - }, - "name": schema.StringAttribute{ - Required: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slack_channel_id": schema.StringAttribute{ - Optional: true, - Description: `The Slack channel ID that this team is associated with`, - }, - "slug": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - }, - } -} - -func (r *TeamResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *TeamResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *TeamResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1Teams() - res, err := r.client.Teams.Post(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.TeamEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedTeamEntity(res.TeamEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var teamID string - teamID = data.ID.ValueString() - - // create.team.litecreate.team.lite impedance mismatch: boolean != classtrace=["Team#create.req"] - var lite *bool - request1 := operations.GetV1TeamsTeamIDRequest{ - TeamID: teamID, - Lite: lite, - } - res1, err := r.client.Teams.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.TeamEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedTeamEntity(res1.TeamEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *TeamResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *TeamResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var teamID string - teamID = data.ID.ValueString() - - // read.team.literead.team.lite impedance mismatch: boolean != classtrace=["Team#create.req"] - var lite *bool - request := operations.GetV1TeamsTeamIDRequest{ - TeamID: teamID, - Lite: lite, - } - res, err := r.client.Teams.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.TeamEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedTeamEntity(res.TeamEntity) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *TeamResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *TeamResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var teamID string - teamID = data.ID.ValueString() - - patchV1TeamsTeamID := *data.ToSharedPatchV1TeamsTeamID() - request := operations.PatchV1TeamsTeamIDRequest{ - TeamID: teamID, - PatchV1TeamsTeamID: patchV1TeamsTeamID, - } - res, err := r.client.Teams.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.TeamEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedTeamEntity(res.TeamEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - var teamId1 string - teamId1 = data.ID.ValueString() - - // update.team.liteupdate.team.lite impedance mismatch: boolean != classtrace=["Team#create.req"] - var lite *bool - request1 := operations.GetV1TeamsTeamIDRequest{ - TeamID: teamId1, - Lite: lite, - } - res1, err := r.client.Teams.Get(ctx, request1) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res1 != nil && res1.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res1.RawResponse)) - } - return - } - if res1 == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res1)) - return - } - if res1.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res1.StatusCode), debugResponse(res1.RawResponse)) - return - } - if !(res1.TeamEntity != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res1.RawResponse)) - return - } - data.RefreshFromSharedTeamEntity(res1.TeamEntity) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *TeamResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *TeamResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var teamID string - teamID = data.ID.ValueString() - - request := operations.DeleteV1TeamsTeamIDRequest{ - TeamID: teamID, - } - res, err := r.client.Teams.Archive(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *TeamResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/team_resource_sdk.go b/internal/provider/team_resource_sdk.go deleted file mode 100644 index e239088..0000000 --- a/internal/provider/team_resource_sdk.go +++ /dev/null @@ -1,563 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *TeamResourceModel) ToSharedPostV1Teams() *shared.PostV1Teams { - var name string - name = r.Name.ValueString() - - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - slug := new(string) - if !r.Slug.IsUnknown() && !r.Slug.IsNull() { - *slug = r.Slug.ValueString() - } else { - slug = nil - } - slackChannelID := new(string) - if !r.SlackChannelID.IsUnknown() && !r.SlackChannelID.IsNull() { - *slackChannelID = r.SlackChannelID.ValueString() - } else { - slackChannelID = nil - } - var msTeamsChannel *shared.MsTeamsChannel - if r.MsTeamsChannel != nil { - var channelID string - channelID = r.MsTeamsChannel.ChannelID.ValueString() - - var msTeamID string - msTeamID = r.MsTeamsChannel.MsTeamID.ValueString() - - msTeamsChannel = &shared.MsTeamsChannel{ - ChannelID: channelID, - MsTeamID: msTeamID, - } - } - var memberships []shared.Memberships = []shared.Memberships{} - for _, membershipsItem := range r.Memberships { - userID := new(string) - if !membershipsItem.UserID.IsUnknown() && !membershipsItem.UserID.IsNull() { - *userID = membershipsItem.UserID.ValueString() - } else { - userID = nil - } - scheduleID := new(string) - if !membershipsItem.ScheduleID.IsUnknown() && !membershipsItem.ScheduleID.IsNull() { - *scheduleID = membershipsItem.ScheduleID.ValueString() - } else { - scheduleID = nil - } - incidentRoleID := new(string) - if !membershipsItem.IncidentRoleID.IsUnknown() && !membershipsItem.IncidentRoleID.IsNull() { - *incidentRoleID = membershipsItem.IncidentRoleID.ValueString() - } else { - incidentRoleID = nil - } - memberships = append(memberships, shared.Memberships{ - UserID: userID, - ScheduleID: scheduleID, - IncidentRoleID: incidentRoleID, - }) - } - out := shared.PostV1Teams{ - Name: name, - Description: description, - Slug: slug, - SlackChannelID: slackChannelID, - MsTeamsChannel: msTeamsChannel, - Memberships: memberships, - } - return &out -} - -func (r *TeamResourceModel) RefreshFromSharedTeamEntity(resp *shared.TeamEntity) { - if resp != nil { - if resp.CreatedAt != nil { - r.CreatedAt = types.StringValue(resp.CreatedAt.Format(time.RFC3339Nano)) - } else { - r.CreatedAt = types.StringNull() - } - if resp.CreatedBy == nil { - r.CreatedBy = nil - } else { - r.CreatedBy = &tfTypes.AuthorEntity{} - r.CreatedBy.Email = types.StringPointerValue(resp.CreatedBy.Email) - r.CreatedBy.ID = types.StringPointerValue(resp.CreatedBy.ID) - r.CreatedBy.Name = types.StringPointerValue(resp.CreatedBy.Name) - r.CreatedBy.Source = types.StringPointerValue(resp.CreatedBy.Source) - } - r.Description = types.StringPointerValue(resp.Description) - r.Functionalities = []tfTypes.FunctionalityEntity{} - if len(r.Functionalities) > len(resp.Functionalities) { - r.Functionalities = r.Functionalities[:len(resp.Functionalities)] - } - for functionalitiesCount, functionalitiesItem := range resp.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(r.Functionalities) { - r.Functionalities = append(r.Functionalities, functionalities1) - } else { - r.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - r.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - r.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - r.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - r.Functionalities[functionalitiesCount].Description = functionalities1.Description - r.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - r.Functionalities[functionalitiesCount].ID = functionalities1.ID - r.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - r.Functionalities[functionalitiesCount].Links = functionalities1.Links - r.Functionalities[functionalitiesCount].Name = functionalities1.Name - r.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - r.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - r.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - r.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - r.ID = types.StringPointerValue(resp.ID) - r.Memberships = []tfTypes.Memberships{} - if len(r.Memberships) > len(resp.Memberships) { - r.Memberships = r.Memberships[:len(resp.Memberships)] - } - for membershipsCount, membershipsItem := range resp.Memberships { - var memberships1 tfTypes.Memberships - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(r.Memberships) { - r.Memberships = append(r.Memberships, memberships1) - } else { - r.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - r.Memberships[membershipsCount].Schedule = memberships1.Schedule - r.Memberships[membershipsCount].User = memberships1.User - } - } - if resp.MsTeamsChannel == nil { - r.MsTeamsChannel = nil - } else { - r.MsTeamsChannel = &tfTypes.MsTeamsChannel{} - r.MsTeamsChannel.ChannelID = types.StringPointerValue(resp.MsTeamsChannel.ChannelID) - r.MsTeamsChannel.ChannelName = types.StringPointerValue(resp.MsTeamsChannel.ChannelName) - r.MsTeamsChannel.ChannelURL = types.StringPointerValue(resp.MsTeamsChannel.ChannelURL) - r.MsTeamsChannel.ID = types.StringPointerValue(resp.MsTeamsChannel.ID) - r.MsTeamsChannel.MsTeamID = types.StringPointerValue(resp.MsTeamsChannel.MsTeamID) - r.MsTeamsChannel.Status = types.StringPointerValue(resp.MsTeamsChannel.Status) - r.MsTeamsChannel.TeamName = types.StringPointerValue(resp.MsTeamsChannel.TeamName) - } - r.Name = types.StringPointerValue(resp.Name) - r.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - if len(r.OwnedFunctionalities) > len(resp.OwnedFunctionalities) { - r.OwnedFunctionalities = r.OwnedFunctionalities[:len(resp.OwnedFunctionalities)] - } - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range resp.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(r.OwnedFunctionalities) { - r.OwnedFunctionalities = append(r.OwnedFunctionalities, ownedFunctionalities1) - } else { - r.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - r.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - r.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - r.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - r.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - r.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - r.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - r.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - r.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - r.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - r.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - r.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - r.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - r.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - r.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - if len(r.OwnedRunbooks) > len(resp.OwnedRunbooks) { - r.OwnedRunbooks = r.OwnedRunbooks[:len(resp.OwnedRunbooks)] - } - for ownedRunbooksCount, ownedRunbooksItem := range resp.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(r.OwnedRunbooks) { - r.OwnedRunbooks = append(r.OwnedRunbooks, ownedRunbooks1) - } else { - r.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - r.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - r.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - r.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - r.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - r.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - r.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - r.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - r.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - r.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - r.SignalsIcalURL = types.StringPointerValue(resp.SignalsIcalURL) - if resp.SlackChannel == nil { - r.SlackChannel = nil - } else { - r.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - r.SlackChannel.ID = types.StringPointerValue(resp.SlackChannel.ID) - r.SlackChannel.Name = types.StringPointerValue(resp.SlackChannel.Name) - r.SlackChannel.SlackChannelID = types.StringPointerValue(resp.SlackChannel.SlackChannelID) - } - r.Slug = types.StringPointerValue(resp.Slug) - if resp.UpdatedAt != nil { - r.UpdatedAt = types.StringValue(resp.UpdatedAt.Format(time.RFC3339Nano)) - } else { - r.UpdatedAt = types.StringNull() - } - } -} - -func (r *TeamResourceModel) ToSharedPatchV1TeamsTeamID() *shared.PatchV1TeamsTeamID { - name := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name = r.Name.ValueString() - } else { - name = nil - } - description := new(string) - if !r.Description.IsUnknown() && !r.Description.IsNull() { - *description = r.Description.ValueString() - } else { - description = nil - } - slug := new(string) - if !r.Slug.IsUnknown() && !r.Slug.IsNull() { - *slug = r.Slug.ValueString() - } else { - slug = nil - } - slackChannelID := new(string) - if !r.SlackChannelID.IsUnknown() && !r.SlackChannelID.IsNull() { - *slackChannelID = r.SlackChannelID.ValueString() - } else { - slackChannelID = nil - } - var msTeamsChannel *shared.PatchV1TeamsTeamIDMsTeamsChannel - if r.MsTeamsChannel != nil { - var channelID string - channelID = r.MsTeamsChannel.ChannelID.ValueString() - - var msTeamID string - msTeamID = r.MsTeamsChannel.MsTeamID.ValueString() - - msTeamsChannel = &shared.PatchV1TeamsTeamIDMsTeamsChannel{ - ChannelID: channelID, - MsTeamID: msTeamID, - } - } - var memberships []shared.PatchV1TeamsTeamIDMemberships = []shared.PatchV1TeamsTeamIDMemberships{} - for _, membershipsItem := range r.Memberships { - userID := new(string) - if !membershipsItem.UserID.IsUnknown() && !membershipsItem.UserID.IsNull() { - *userID = membershipsItem.UserID.ValueString() - } else { - userID = nil - } - scheduleID := new(string) - if !membershipsItem.ScheduleID.IsUnknown() && !membershipsItem.ScheduleID.IsNull() { - *scheduleID = membershipsItem.ScheduleID.ValueString() - } else { - scheduleID = nil - } - incidentRoleID := new(string) - if !membershipsItem.IncidentRoleID.IsUnknown() && !membershipsItem.IncidentRoleID.IsNull() { - *incidentRoleID = membershipsItem.IncidentRoleID.ValueString() - } else { - incidentRoleID = nil - } - memberships = append(memberships, shared.PatchV1TeamsTeamIDMemberships{ - UserID: userID, - ScheduleID: scheduleID, - IncidentRoleID: incidentRoleID, - }) - } - out := shared.PatchV1TeamsTeamID{ - Name: name, - Description: description, - Slug: slug, - SlackChannelID: slackChannelID, - MsTeamsChannel: msTeamsChannel, - Memberships: memberships, - } - return &out -} diff --git a/internal/provider/teams_data_source.go b/internal/provider/teams_data_source.go deleted file mode 100644 index c2b3210..0000000 --- a/internal/provider/teams_data_source.go +++ /dev/null @@ -1,680 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &TeamsDataSource{} -var _ datasource.DataSourceWithConfigure = &TeamsDataSource{} - -func NewTeamsDataSource() datasource.DataSource { - return &TeamsDataSource{} -} - -// TeamsDataSource is the data source implementation. -type TeamsDataSource struct { - client *sdk.Firehydrant -} - -// TeamsDataSourceModel describes the data model. -type TeamsDataSourceModel struct { - Data []tfTypes.TeamEntity `tfsdk:"data"` - DefaultIncidentRole types.String `tfsdk:"default_incident_role"` - Lite types.Bool `tfsdk:"lite"` - Name types.String `tfsdk:"name"` - Page types.Int64 `tfsdk:"page"` - Pagination *tfTypes.PaginationEntity `tfsdk:"pagination"` - PerPage types.Int64 `tfsdk:"per_page"` - Query types.String `tfsdk:"query"` - Services types.String `tfsdk:"services"` -} - -// Metadata returns the data source type name. -func (r *TeamsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_teams" -} - -// Schema defines the schema for the data source. -func (r *TeamsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Teams DataSource", - - Attributes: map[string]schema.Attribute{ - "data": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "memberships": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "default_incident_role": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "discarded_at": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - Description: `IncidentRoleEntity model`, - }, - "schedule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "discarded": schema.BoolAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "integration": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "user": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "ms_teams_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "channel_id": schema.StringAttribute{ - Computed: true, - }, - "channel_name": schema.StringAttribute{ - Computed: true, - }, - "channel_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "ms_team_id": schema.StringAttribute{ - Computed: true, - }, - "status": schema.StringAttribute{ - Computed: true, - }, - "team_name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owned_functionalities": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "active_incidents": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `List of active incident guids`, - }, - "alert_on_add": schema.BoolAttribute{ - Computed: true, - }, - "auto_add_responding_team": schema.BoolAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "external_resources": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "connection_id": schema.StringAttribute{ - Computed: true, - }, - "connection_name": schema.StringAttribute{ - Computed: true, - }, - "connection_type": schema.StringAttribute{ - Computed: true, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "remote_id": schema.StringAttribute{ - Computed: true, - }, - "remote_url": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `Information about known linkages to representations of services outside of FireHydrant.`, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "labels": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `An object of label key and values`, - }, - "links": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "href_url": schema.StringAttribute{ - Computed: true, - }, - "icon_url": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - }, - }, - Description: `List of links attached to this functionality.`, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "updated_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - }, - "owned_runbooks": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "attachment_rule": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "logic": schema.SingleNestedAttribute{ - Computed: true, - Description: `An unstructured object of key/value pairs describing the logic for applying the rule.`, - }, - "user_data": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "label": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "value": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "categories": schema.StringAttribute{ - Computed: true, - Description: `categories the runbook applies to`, - }, - "created_at": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "owner": schema.SingleNestedAttribute{ - Computed: true, - Description: `TeamEntity model`, - }, - "summary": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "signals_ical_url": schema.StringAttribute{ - Computed: true, - }, - "slack_channel": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "slack_channel_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "slug": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "default_incident_role": schema.StringAttribute{ - Optional: true, - Description: `Filter by teams that have or do not have members with a default incident role asssigned. Value may be 'present', 'blank', or the ID of an incident role.`, - }, - "lite": schema.BoolAttribute{ - Optional: true, - Description: `Boolean to determine whether to return a slimified version of the teams object`, - }, - "name": schema.StringAttribute{ - Optional: true, - Description: `A query to search teams by their name`, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "pagination": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "count": schema.Int64Attribute{ - Computed: true, - }, - "items": schema.Int64Attribute{ - Computed: true, - }, - "last": schema.Int64Attribute{ - Computed: true, - }, - "next": schema.Int64Attribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Computed: true, - }, - "pages": schema.Int64Attribute{ - Computed: true, - }, - "prev": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "query": schema.StringAttribute{ - Optional: true, - Description: `A query to search teams by their name or description`, - }, - "services": schema.StringAttribute{ - Optional: true, - Description: `A comma separated list of service IDs`, - }, - }, - } -} - -func (r *TeamsDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *TeamsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *TeamsDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - query := new(string) - if !data.Query.IsUnknown() && !data.Query.IsNull() { - *query = data.Query.ValueString() - } else { - query = nil - } - name := new(string) - if !data.Name.IsUnknown() && !data.Name.IsNull() { - *name = data.Name.ValueString() - } else { - name = nil - } - services := new(string) - if !data.Services.IsUnknown() && !data.Services.IsNull() { - *services = data.Services.ValueString() - } else { - services = nil - } - defaultIncidentRole := new(string) - if !data.DefaultIncidentRole.IsUnknown() && !data.DefaultIncidentRole.IsNull() { - *defaultIncidentRole = data.DefaultIncidentRole.ValueString() - } else { - defaultIncidentRole = nil - } - lite := new(bool) - if !data.Lite.IsUnknown() && !data.Lite.IsNull() { - *lite = data.Lite.ValueBool() - } else { - lite = nil - } - request := operations.GetV1TeamsRequest{ - Page: page, - PerPage: perPage, - Query: query, - Name: name, - Services: services, - DefaultIncidentRole: defaultIncidentRole, - Lite: lite, - } - res, err := r.client.Teams.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.TeamEntityPaginated != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedTeamEntityPaginated(res.TeamEntityPaginated) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/teams_data_source_sdk.go b/internal/provider/teams_data_source_sdk.go deleted file mode 100644 index bcac099..0000000 --- a/internal/provider/teams_data_source_sdk.go +++ /dev/null @@ -1,469 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *TeamsDataSourceModel) RefreshFromSharedTeamEntityPaginated(resp *shared.TeamEntityPaginated) { - if resp != nil { - r.Data = []tfTypes.TeamEntity{} - if len(r.Data) > len(resp.Data) { - r.Data = r.Data[:len(resp.Data)] - } - for dataCount, dataItem := range resp.Data { - var data1 tfTypes.TeamEntity - if dataItem.CreatedAt != nil { - data1.CreatedAt = types.StringValue(dataItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.CreatedAt = types.StringNull() - } - if dataItem.CreatedBy == nil { - data1.CreatedBy = nil - } else { - data1.CreatedBy = &tfTypes.AuthorEntity{} - data1.CreatedBy.Email = types.StringPointerValue(dataItem.CreatedBy.Email) - data1.CreatedBy.ID = types.StringPointerValue(dataItem.CreatedBy.ID) - data1.CreatedBy.Name = types.StringPointerValue(dataItem.CreatedBy.Name) - data1.CreatedBy.Source = types.StringPointerValue(dataItem.CreatedBy.Source) - } - data1.Description = types.StringPointerValue(dataItem.Description) - data1.Functionalities = []tfTypes.FunctionalityEntity{} - for functionalitiesCount, functionalitiesItem := range dataItem.Functionalities { - var functionalities1 tfTypes.FunctionalityEntity - functionalities1.ActiveIncidents = []types.String{} - for _, v := range functionalitiesItem.ActiveIncidents { - functionalities1.ActiveIncidents = append(functionalities1.ActiveIncidents, types.StringValue(v)) - } - functionalities1.AlertOnAdd = types.BoolPointerValue(functionalitiesItem.AlertOnAdd) - functionalities1.AutoAddRespondingTeam = types.BoolPointerValue(functionalitiesItem.AutoAddRespondingTeam) - if functionalitiesItem.CreatedAt != nil { - functionalities1.CreatedAt = types.StringValue(functionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.CreatedAt = types.StringNull() - } - functionalities1.Description = types.StringPointerValue(functionalitiesItem.Description) - functionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount, externalResourcesItem := range functionalitiesItem.ExternalResources { - var externalResources1 tfTypes.ExternalResourceEntity - externalResources1.ConnectionID = types.StringPointerValue(externalResourcesItem.ConnectionID) - externalResources1.ConnectionName = types.StringPointerValue(externalResourcesItem.ConnectionName) - externalResources1.ConnectionType = types.StringPointerValue(externalResourcesItem.ConnectionType) - if externalResourcesItem.CreatedAt != nil { - externalResources1.CreatedAt = types.StringValue(externalResourcesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.CreatedAt = types.StringNull() - } - externalResources1.Name = types.StringPointerValue(externalResourcesItem.Name) - externalResources1.RemoteID = types.StringPointerValue(externalResourcesItem.RemoteID) - externalResources1.RemoteURL = types.StringPointerValue(externalResourcesItem.RemoteURL) - if externalResourcesItem.UpdatedAt != nil { - externalResources1.UpdatedAt = types.StringValue(externalResourcesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources1.UpdatedAt = types.StringNull() - } - if externalResourcesCount+1 > len(functionalities1.ExternalResources) { - functionalities1.ExternalResources = append(functionalities1.ExternalResources, externalResources1) - } else { - functionalities1.ExternalResources[externalResourcesCount].ConnectionID = externalResources1.ConnectionID - functionalities1.ExternalResources[externalResourcesCount].ConnectionName = externalResources1.ConnectionName - functionalities1.ExternalResources[externalResourcesCount].ConnectionType = externalResources1.ConnectionType - functionalities1.ExternalResources[externalResourcesCount].CreatedAt = externalResources1.CreatedAt - functionalities1.ExternalResources[externalResourcesCount].Name = externalResources1.Name - functionalities1.ExternalResources[externalResourcesCount].RemoteID = externalResources1.RemoteID - functionalities1.ExternalResources[externalResourcesCount].RemoteURL = externalResources1.RemoteURL - functionalities1.ExternalResources[externalResourcesCount].UpdatedAt = externalResources1.UpdatedAt - } - } - functionalities1.ID = types.StringPointerValue(functionalitiesItem.ID) - if len(functionalitiesItem.Labels) > 0 { - functionalities1.Labels = make(map[string]types.String) - for key, value := range functionalitiesItem.Labels { - functionalities1.Labels[key] = types.StringValue(value) - } - } - functionalities1.Links = []tfTypes.LinksEntity{} - for linksCount, linksItem := range functionalitiesItem.Links { - var links1 tfTypes.LinksEntity - links1.HrefURL = types.StringPointerValue(linksItem.HrefURL) - links1.IconURL = types.StringPointerValue(linksItem.IconURL) - links1.ID = types.StringPointerValue(linksItem.ID) - links1.Name = types.StringPointerValue(linksItem.Name) - if linksCount+1 > len(functionalities1.Links) { - functionalities1.Links = append(functionalities1.Links, links1) - } else { - functionalities1.Links[linksCount].HrefURL = links1.HrefURL - functionalities1.Links[linksCount].IconURL = links1.IconURL - functionalities1.Links[linksCount].ID = links1.ID - functionalities1.Links[linksCount].Name = links1.Name - } - } - functionalities1.Name = types.StringPointerValue(functionalitiesItem.Name) - if functionalitiesItem.Owner == nil { - functionalities1.Owner = nil - } else { - functionalities1.Owner = &tfTypes.TeamEntity1{} - } - functionalities1.Slug = types.StringPointerValue(functionalitiesItem.Slug) - if functionalitiesItem.UpdatedAt != nil { - functionalities1.UpdatedAt = types.StringValue(functionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - functionalities1.UpdatedAt = types.StringNull() - } - if functionalitiesItem.UpdatedBy == nil { - functionalities1.UpdatedBy = nil - } else { - functionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - functionalities1.UpdatedBy.Email = types.StringPointerValue(functionalitiesItem.UpdatedBy.Email) - functionalities1.UpdatedBy.ID = types.StringPointerValue(functionalitiesItem.UpdatedBy.ID) - functionalities1.UpdatedBy.Name = types.StringPointerValue(functionalitiesItem.UpdatedBy.Name) - functionalities1.UpdatedBy.Source = types.StringPointerValue(functionalitiesItem.UpdatedBy.Source) - } - if functionalitiesCount+1 > len(data1.Functionalities) { - data1.Functionalities = append(data1.Functionalities, functionalities1) - } else { - data1.Functionalities[functionalitiesCount].ActiveIncidents = functionalities1.ActiveIncidents - data1.Functionalities[functionalitiesCount].AlertOnAdd = functionalities1.AlertOnAdd - data1.Functionalities[functionalitiesCount].AutoAddRespondingTeam = functionalities1.AutoAddRespondingTeam - data1.Functionalities[functionalitiesCount].CreatedAt = functionalities1.CreatedAt - data1.Functionalities[functionalitiesCount].Description = functionalities1.Description - data1.Functionalities[functionalitiesCount].ExternalResources = functionalities1.ExternalResources - data1.Functionalities[functionalitiesCount].ID = functionalities1.ID - data1.Functionalities[functionalitiesCount].Labels = functionalities1.Labels - data1.Functionalities[functionalitiesCount].Links = functionalities1.Links - data1.Functionalities[functionalitiesCount].Name = functionalities1.Name - data1.Functionalities[functionalitiesCount].Owner = functionalities1.Owner - data1.Functionalities[functionalitiesCount].Slug = functionalities1.Slug - data1.Functionalities[functionalitiesCount].UpdatedAt = functionalities1.UpdatedAt - data1.Functionalities[functionalitiesCount].UpdatedBy = functionalities1.UpdatedBy - } - } - data1.ID = types.StringPointerValue(dataItem.ID) - data1.Memberships = []tfTypes.MembershipEntity{} - for membershipsCount, membershipsItem := range dataItem.Memberships { - var memberships1 tfTypes.MembershipEntity - if membershipsItem.DefaultIncidentRole == nil { - memberships1.DefaultIncidentRole = nil - } else { - memberships1.DefaultIncidentRole = &tfTypes.IncidentRoleEntity{} - if membershipsItem.DefaultIncidentRole.CreatedAt != nil { - memberships1.DefaultIncidentRole.CreatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.CreatedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.Description = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Description) - if membershipsItem.DefaultIncidentRole.DiscardedAt != nil { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringValue(membershipsItem.DefaultIncidentRole.DiscardedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.DiscardedAt = types.StringNull() - } - memberships1.DefaultIncidentRole.ID = types.StringPointerValue(membershipsItem.DefaultIncidentRole.ID) - memberships1.DefaultIncidentRole.Name = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Name) - memberships1.DefaultIncidentRole.Summary = types.StringPointerValue(membershipsItem.DefaultIncidentRole.Summary) - if membershipsItem.DefaultIncidentRole.UpdatedAt != nil { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringValue(membershipsItem.DefaultIncidentRole.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.DefaultIncidentRole.UpdatedAt = types.StringNull() - } - } - if membershipsItem.Schedule == nil { - memberships1.Schedule = nil - } else { - memberships1.Schedule = &tfTypes.ScheduleEntity{} - memberships1.Schedule.Discarded = types.BoolPointerValue(membershipsItem.Schedule.Discarded) - memberships1.Schedule.ID = types.StringPointerValue(membershipsItem.Schedule.ID) - memberships1.Schedule.Integration = types.StringPointerValue(membershipsItem.Schedule.Integration) - memberships1.Schedule.Name = types.StringPointerValue(membershipsItem.Schedule.Name) - } - if membershipsItem.User == nil { - memberships1.User = nil - } else { - memberships1.User = &tfTypes.UserEntity{} - if membershipsItem.User.CreatedAt != nil { - memberships1.User.CreatedAt = types.StringValue(membershipsItem.User.CreatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.CreatedAt = types.StringNull() - } - memberships1.User.Email = types.StringPointerValue(membershipsItem.User.Email) - memberships1.User.ID = types.StringPointerValue(membershipsItem.User.ID) - memberships1.User.Name = types.StringPointerValue(membershipsItem.User.Name) - memberships1.User.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range membershipsItem.User.SignalsEnabledNotificationTypes { - memberships1.User.SignalsEnabledNotificationTypes = append(memberships1.User.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - memberships1.User.SlackLinked = types.BoolPointerValue(membershipsItem.User.SlackLinked) - memberships1.User.SlackUserID = types.StringPointerValue(membershipsItem.User.SlackUserID) - if membershipsItem.User.UpdatedAt != nil { - memberships1.User.UpdatedAt = types.StringValue(membershipsItem.User.UpdatedAt.Format(time.RFC3339Nano)) - } else { - memberships1.User.UpdatedAt = types.StringNull() - } - } - if membershipsCount+1 > len(data1.Memberships) { - data1.Memberships = append(data1.Memberships, memberships1) - } else { - data1.Memberships[membershipsCount].DefaultIncidentRole = memberships1.DefaultIncidentRole - data1.Memberships[membershipsCount].Schedule = memberships1.Schedule - data1.Memberships[membershipsCount].User = memberships1.User - } - } - if dataItem.MsTeamsChannel == nil { - data1.MsTeamsChannel = nil - } else { - data1.MsTeamsChannel = &tfTypes.IntegrationsMicrosoftTeamsV2ChannelEntity{} - data1.MsTeamsChannel.ChannelID = types.StringPointerValue(dataItem.MsTeamsChannel.ChannelID) - data1.MsTeamsChannel.ChannelName = types.StringPointerValue(dataItem.MsTeamsChannel.ChannelName) - data1.MsTeamsChannel.ChannelURL = types.StringPointerValue(dataItem.MsTeamsChannel.ChannelURL) - data1.MsTeamsChannel.ID = types.StringPointerValue(dataItem.MsTeamsChannel.ID) - data1.MsTeamsChannel.MsTeamID = types.StringPointerValue(dataItem.MsTeamsChannel.MsTeamID) - data1.MsTeamsChannel.Status = types.StringPointerValue(dataItem.MsTeamsChannel.Status) - data1.MsTeamsChannel.TeamName = types.StringPointerValue(dataItem.MsTeamsChannel.TeamName) - } - data1.Name = types.StringPointerValue(dataItem.Name) - data1.OwnedFunctionalities = []tfTypes.FunctionalityEntity{} - for ownedFunctionalitiesCount, ownedFunctionalitiesItem := range dataItem.OwnedFunctionalities { - var ownedFunctionalities1 tfTypes.FunctionalityEntity - ownedFunctionalities1.ActiveIncidents = []types.String{} - for _, v := range ownedFunctionalitiesItem.ActiveIncidents { - ownedFunctionalities1.ActiveIncidents = append(ownedFunctionalities1.ActiveIncidents, types.StringValue(v)) - } - ownedFunctionalities1.AlertOnAdd = types.BoolPointerValue(ownedFunctionalitiesItem.AlertOnAdd) - ownedFunctionalities1.AutoAddRespondingTeam = types.BoolPointerValue(ownedFunctionalitiesItem.AutoAddRespondingTeam) - if ownedFunctionalitiesItem.CreatedAt != nil { - ownedFunctionalities1.CreatedAt = types.StringValue(ownedFunctionalitiesItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.CreatedAt = types.StringNull() - } - ownedFunctionalities1.Description = types.StringPointerValue(ownedFunctionalitiesItem.Description) - ownedFunctionalities1.ExternalResources = []tfTypes.ExternalResourceEntity{} - for externalResourcesCount1, externalResourcesItem1 := range ownedFunctionalitiesItem.ExternalResources { - var externalResources3 tfTypes.ExternalResourceEntity - externalResources3.ConnectionID = types.StringPointerValue(externalResourcesItem1.ConnectionID) - externalResources3.ConnectionName = types.StringPointerValue(externalResourcesItem1.ConnectionName) - externalResources3.ConnectionType = types.StringPointerValue(externalResourcesItem1.ConnectionType) - if externalResourcesItem1.CreatedAt != nil { - externalResources3.CreatedAt = types.StringValue(externalResourcesItem1.CreatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.CreatedAt = types.StringNull() - } - externalResources3.Name = types.StringPointerValue(externalResourcesItem1.Name) - externalResources3.RemoteID = types.StringPointerValue(externalResourcesItem1.RemoteID) - externalResources3.RemoteURL = types.StringPointerValue(externalResourcesItem1.RemoteURL) - if externalResourcesItem1.UpdatedAt != nil { - externalResources3.UpdatedAt = types.StringValue(externalResourcesItem1.UpdatedAt.Format(time.RFC3339Nano)) - } else { - externalResources3.UpdatedAt = types.StringNull() - } - if externalResourcesCount1+1 > len(ownedFunctionalities1.ExternalResources) { - ownedFunctionalities1.ExternalResources = append(ownedFunctionalities1.ExternalResources, externalResources3) - } else { - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionID = externalResources3.ConnectionID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionName = externalResources3.ConnectionName - ownedFunctionalities1.ExternalResources[externalResourcesCount1].ConnectionType = externalResources3.ConnectionType - ownedFunctionalities1.ExternalResources[externalResourcesCount1].CreatedAt = externalResources3.CreatedAt - ownedFunctionalities1.ExternalResources[externalResourcesCount1].Name = externalResources3.Name - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteID = externalResources3.RemoteID - ownedFunctionalities1.ExternalResources[externalResourcesCount1].RemoteURL = externalResources3.RemoteURL - ownedFunctionalities1.ExternalResources[externalResourcesCount1].UpdatedAt = externalResources3.UpdatedAt - } - } - ownedFunctionalities1.ID = types.StringPointerValue(ownedFunctionalitiesItem.ID) - if len(ownedFunctionalitiesItem.Labels) > 0 { - ownedFunctionalities1.Labels = make(map[string]types.String) - for key1, value1 := range ownedFunctionalitiesItem.Labels { - ownedFunctionalities1.Labels[key1] = types.StringValue(value1) - } - } - ownedFunctionalities1.Links = []tfTypes.LinksEntity{} - for linksCount1, linksItem1 := range ownedFunctionalitiesItem.Links { - var links3 tfTypes.LinksEntity - links3.HrefURL = types.StringPointerValue(linksItem1.HrefURL) - links3.IconURL = types.StringPointerValue(linksItem1.IconURL) - links3.ID = types.StringPointerValue(linksItem1.ID) - links3.Name = types.StringPointerValue(linksItem1.Name) - if linksCount1+1 > len(ownedFunctionalities1.Links) { - ownedFunctionalities1.Links = append(ownedFunctionalities1.Links, links3) - } else { - ownedFunctionalities1.Links[linksCount1].HrefURL = links3.HrefURL - ownedFunctionalities1.Links[linksCount1].IconURL = links3.IconURL - ownedFunctionalities1.Links[linksCount1].ID = links3.ID - ownedFunctionalities1.Links[linksCount1].Name = links3.Name - } - } - ownedFunctionalities1.Name = types.StringPointerValue(ownedFunctionalitiesItem.Name) - if ownedFunctionalitiesItem.Owner == nil { - ownedFunctionalities1.Owner = nil - } else { - ownedFunctionalities1.Owner = &tfTypes.TeamEntity1{} - } - ownedFunctionalities1.Slug = types.StringPointerValue(ownedFunctionalitiesItem.Slug) - if ownedFunctionalitiesItem.UpdatedAt != nil { - ownedFunctionalities1.UpdatedAt = types.StringValue(ownedFunctionalitiesItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedFunctionalities1.UpdatedAt = types.StringNull() - } - if ownedFunctionalitiesItem.UpdatedBy == nil { - ownedFunctionalities1.UpdatedBy = nil - } else { - ownedFunctionalities1.UpdatedBy = &tfTypes.AuthorEntity{} - ownedFunctionalities1.UpdatedBy.Email = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Email) - ownedFunctionalities1.UpdatedBy.ID = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.ID) - ownedFunctionalities1.UpdatedBy.Name = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Name) - ownedFunctionalities1.UpdatedBy.Source = types.StringPointerValue(ownedFunctionalitiesItem.UpdatedBy.Source) - } - if ownedFunctionalitiesCount+1 > len(data1.OwnedFunctionalities) { - data1.OwnedFunctionalities = append(data1.OwnedFunctionalities, ownedFunctionalities1) - } else { - data1.OwnedFunctionalities[ownedFunctionalitiesCount].ActiveIncidents = ownedFunctionalities1.ActiveIncidents - data1.OwnedFunctionalities[ownedFunctionalitiesCount].AlertOnAdd = ownedFunctionalities1.AlertOnAdd - data1.OwnedFunctionalities[ownedFunctionalitiesCount].AutoAddRespondingTeam = ownedFunctionalities1.AutoAddRespondingTeam - data1.OwnedFunctionalities[ownedFunctionalitiesCount].CreatedAt = ownedFunctionalities1.CreatedAt - data1.OwnedFunctionalities[ownedFunctionalitiesCount].Description = ownedFunctionalities1.Description - data1.OwnedFunctionalities[ownedFunctionalitiesCount].ExternalResources = ownedFunctionalities1.ExternalResources - data1.OwnedFunctionalities[ownedFunctionalitiesCount].ID = ownedFunctionalities1.ID - data1.OwnedFunctionalities[ownedFunctionalitiesCount].Labels = ownedFunctionalities1.Labels - data1.OwnedFunctionalities[ownedFunctionalitiesCount].Links = ownedFunctionalities1.Links - data1.OwnedFunctionalities[ownedFunctionalitiesCount].Name = ownedFunctionalities1.Name - data1.OwnedFunctionalities[ownedFunctionalitiesCount].Owner = ownedFunctionalities1.Owner - data1.OwnedFunctionalities[ownedFunctionalitiesCount].Slug = ownedFunctionalities1.Slug - data1.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedAt = ownedFunctionalities1.UpdatedAt - data1.OwnedFunctionalities[ownedFunctionalitiesCount].UpdatedBy = ownedFunctionalities1.UpdatedBy - } - } - data1.OwnedRunbooks = []tfTypes.SlimRunbookEntity{} - for ownedRunbooksCount, ownedRunbooksItem := range dataItem.OwnedRunbooks { - var ownedRunbooks1 tfTypes.SlimRunbookEntity - if ownedRunbooksItem.AttachmentRule == nil { - ownedRunbooks1.AttachmentRule = nil - } else { - ownedRunbooks1.AttachmentRule = &tfTypes.RulesRuleEntity{} - if ownedRunbooksItem.AttachmentRule.Logic == nil { - ownedRunbooks1.AttachmentRule.Logic = nil - } else { - ownedRunbooks1.AttachmentRule.Logic = &tfTypes.TeamEntity1{} - } - if ownedRunbooksItem.AttachmentRule.UserData == nil { - ownedRunbooks1.AttachmentRule.UserData = nil - } else { - ownedRunbooks1.AttachmentRule.UserData = &tfTypes.FHTypesGenericEntity{} - ownedRunbooks1.AttachmentRule.UserData.Label = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Label) - ownedRunbooks1.AttachmentRule.UserData.Type = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Type) - ownedRunbooks1.AttachmentRule.UserData.Value = types.StringPointerValue(ownedRunbooksItem.AttachmentRule.UserData.Value) - } - } - ownedRunbooks1.Categories = types.StringPointerValue(ownedRunbooksItem.Categories) - if ownedRunbooksItem.CreatedAt != nil { - ownedRunbooks1.CreatedAt = types.StringValue(ownedRunbooksItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.CreatedAt = types.StringNull() - } - ownedRunbooks1.Description = types.StringPointerValue(ownedRunbooksItem.Description) - ownedRunbooks1.ID = types.StringPointerValue(ownedRunbooksItem.ID) - ownedRunbooks1.Name = types.StringPointerValue(ownedRunbooksItem.Name) - if ownedRunbooksItem.Owner == nil { - ownedRunbooks1.Owner = nil - } else { - ownedRunbooks1.Owner = &tfTypes.TeamEntity1{} - } - ownedRunbooks1.Summary = types.StringPointerValue(ownedRunbooksItem.Summary) - ownedRunbooks1.Type = types.StringPointerValue(ownedRunbooksItem.Type) - if ownedRunbooksItem.UpdatedAt != nil { - ownedRunbooks1.UpdatedAt = types.StringValue(ownedRunbooksItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - ownedRunbooks1.UpdatedAt = types.StringNull() - } - if ownedRunbooksCount+1 > len(data1.OwnedRunbooks) { - data1.OwnedRunbooks = append(data1.OwnedRunbooks, ownedRunbooks1) - } else { - data1.OwnedRunbooks[ownedRunbooksCount].AttachmentRule = ownedRunbooks1.AttachmentRule - data1.OwnedRunbooks[ownedRunbooksCount].Categories = ownedRunbooks1.Categories - data1.OwnedRunbooks[ownedRunbooksCount].CreatedAt = ownedRunbooks1.CreatedAt - data1.OwnedRunbooks[ownedRunbooksCount].Description = ownedRunbooks1.Description - data1.OwnedRunbooks[ownedRunbooksCount].ID = ownedRunbooks1.ID - data1.OwnedRunbooks[ownedRunbooksCount].Name = ownedRunbooks1.Name - data1.OwnedRunbooks[ownedRunbooksCount].Owner = ownedRunbooks1.Owner - data1.OwnedRunbooks[ownedRunbooksCount].Summary = ownedRunbooks1.Summary - data1.OwnedRunbooks[ownedRunbooksCount].Type = ownedRunbooks1.Type - data1.OwnedRunbooks[ownedRunbooksCount].UpdatedAt = ownedRunbooks1.UpdatedAt - } - } - data1.SignalsIcalURL = types.StringPointerValue(dataItem.SignalsIcalURL) - if dataItem.SlackChannel == nil { - data1.SlackChannel = nil - } else { - data1.SlackChannel = &tfTypes.IntegrationsSlackSlackChannelEntity{} - data1.SlackChannel.ID = types.StringPointerValue(dataItem.SlackChannel.ID) - data1.SlackChannel.Name = types.StringPointerValue(dataItem.SlackChannel.Name) - data1.SlackChannel.SlackChannelID = types.StringPointerValue(dataItem.SlackChannel.SlackChannelID) - } - data1.Slug = types.StringPointerValue(dataItem.Slug) - if dataItem.UpdatedAt != nil { - data1.UpdatedAt = types.StringValue(dataItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.UpdatedAt = types.StringNull() - } - if dataCount+1 > len(r.Data) { - r.Data = append(r.Data, data1) - } else { - r.Data[dataCount].CreatedAt = data1.CreatedAt - r.Data[dataCount].CreatedBy = data1.CreatedBy - r.Data[dataCount].Description = data1.Description - r.Data[dataCount].Functionalities = data1.Functionalities - r.Data[dataCount].ID = data1.ID - r.Data[dataCount].Memberships = data1.Memberships - r.Data[dataCount].MsTeamsChannel = data1.MsTeamsChannel - r.Data[dataCount].Name = data1.Name - r.Data[dataCount].OwnedFunctionalities = data1.OwnedFunctionalities - r.Data[dataCount].OwnedRunbooks = data1.OwnedRunbooks - r.Data[dataCount].SignalsIcalURL = data1.SignalsIcalURL - r.Data[dataCount].SlackChannel = data1.SlackChannel - r.Data[dataCount].Slug = data1.Slug - r.Data[dataCount].UpdatedAt = data1.UpdatedAt - } - } - if resp.Pagination == nil { - r.Pagination = nil - } else { - r.Pagination = &tfTypes.PaginationEntity{} - if resp.Pagination.Count != nil { - r.Pagination.Count = types.Int64Value(int64(*resp.Pagination.Count)) - } else { - r.Pagination.Count = types.Int64Null() - } - if resp.Pagination.Items != nil { - r.Pagination.Items = types.Int64Value(int64(*resp.Pagination.Items)) - } else { - r.Pagination.Items = types.Int64Null() - } - if resp.Pagination.Last != nil { - r.Pagination.Last = types.Int64Value(int64(*resp.Pagination.Last)) - } else { - r.Pagination.Last = types.Int64Null() - } - if resp.Pagination.Next != nil { - r.Pagination.Next = types.Int64Value(int64(*resp.Pagination.Next)) - } else { - r.Pagination.Next = types.Int64Null() - } - if resp.Pagination.Page != nil { - r.Pagination.Page = types.Int64Value(int64(*resp.Pagination.Page)) - } else { - r.Pagination.Page = types.Int64Null() - } - if resp.Pagination.Pages != nil { - r.Pagination.Pages = types.Int64Value(int64(*resp.Pagination.Pages)) - } else { - r.Pagination.Pages = types.Int64Null() - } - if resp.Pagination.Prev != nil { - r.Pagination.Prev = types.Int64Value(int64(*resp.Pagination.Prev)) - } else { - r.Pagination.Prev = types.Int64Null() - } - } - } -} diff --git a/internal/provider/types/attachment_rule.go b/internal/provider/types/attachment_rule.go deleted file mode 100644 index 8822ff8..0000000 --- a/internal/provider/types/attachment_rule.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type AttachmentRule struct { - Logic types.String `tfsdk:"logic"` - UserData types.String `tfsdk:"user_data"` -} diff --git a/internal/provider/types/author_entity.go b/internal/provider/types/author_entity.go deleted file mode 100644 index 0e960db..0000000 --- a/internal/provider/types/author_entity.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type AuthorEntity struct { - Email types.String `tfsdk:"email"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Source types.String `tfsdk:"source"` -} diff --git a/internal/provider/types/checklist_check_entity.go b/internal/provider/types/checklist_check_entity.go deleted file mode 100644 index 193b829..0000000 --- a/internal/provider/types/checklist_check_entity.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ChecklistCheckEntity struct { - Description types.String `tfsdk:"description"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Status types.Bool `tfsdk:"status"` -} diff --git a/internal/provider/types/checklists.go b/internal/provider/types/checklists.go deleted file mode 100644 index f42ac71..0000000 --- a/internal/provider/types/checklists.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Checklists struct { - Checks []ChecklistCheckEntity `tfsdk:"checks"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Owner *TeamEntity `tfsdk:"owner"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/checks.go b/internal/provider/types/checks.go deleted file mode 100644 index c9bb6bc..0000000 --- a/internal/provider/types/checks.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Checks struct { - Description types.String `tfsdk:"description"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Status types.Bool `tfsdk:"status"` -} diff --git a/internal/provider/types/environment_entry_entity.go b/internal/provider/types/environment_entry_entity.go deleted file mode 100644 index 03a4903..0000000 --- a/internal/provider/types/environment_entry_entity.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EnvironmentEntryEntity struct { - ActiveIncidents types.String `tfsdk:"active_incidents"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []ExternalResourceEntity `tfsdk:"external_resources"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/external_resource_entity.go b/internal/provider/types/external_resource_entity.go deleted file mode 100644 index adb50df..0000000 --- a/internal/provider/types/external_resource_entity.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ExternalResourceEntity struct { - ConnectionID types.String `tfsdk:"connection_id"` - ConnectionName types.String `tfsdk:"connection_name"` - ConnectionType types.String `tfsdk:"connection_type"` - CreatedAt types.String `tfsdk:"created_at"` - Name types.String `tfsdk:"name"` - RemoteID types.String `tfsdk:"remote_id"` - RemoteURL types.String `tfsdk:"remote_url"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/external_resource_entity1.go b/internal/provider/types/external_resource_entity1.go deleted file mode 100644 index fea415c..0000000 --- a/internal/provider/types/external_resource_entity1.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ExternalResourceEntity1 struct { - ConnectionID types.String `tfsdk:"connection_id"` - ConnectionName types.String `tfsdk:"connection_name"` - ConnectionType types.String `tfsdk:"connection_type"` - CreatedAt types.String `tfsdk:"created_at"` - Name types.String `tfsdk:"name"` - RemoteID types.String `tfsdk:"remote_id"` - RemoteURL types.String `tfsdk:"remote_url"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/fh_types_generic_entity.go b/internal/provider/types/fh_types_generic_entity.go deleted file mode 100644 index 97e0ed1..0000000 --- a/internal/provider/types/fh_types_generic_entity.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type FHTypesGenericEntity struct { - Label types.String `tfsdk:"label"` - Type types.String `tfsdk:"type"` - Value types.String `tfsdk:"value"` -} diff --git a/internal/provider/types/functionalities.go b/internal/provider/types/functionalities.go deleted file mode 100644 index 955720c..0000000 --- a/internal/provider/types/functionalities.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Functionalities struct { - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []ExternalResourceEntity `tfsdk:"external_resources"` - ID types.String `tfsdk:"id"` - Labels map[string]types.String `tfsdk:"labels"` - Links []LinksEntity `tfsdk:"links"` - Name types.String `tfsdk:"name"` - Owner *TeamEntity1 `tfsdk:"owner"` - Slug types.String `tfsdk:"slug"` - Summary types.String `tfsdk:"summary"` - UpdatedAt types.String `tfsdk:"updated_at"` - UpdatedBy *AuthorEntity `tfsdk:"updated_by"` -} diff --git a/internal/provider/types/functionality_entity.go b/internal/provider/types/functionality_entity.go deleted file mode 100644 index ec3ddca..0000000 --- a/internal/provider/types/functionality_entity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type FunctionalityEntity struct { - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []ExternalResourceEntity `tfsdk:"external_resources"` - ID types.String `tfsdk:"id"` - Labels map[string]types.String `tfsdk:"labels"` - Links []LinksEntity `tfsdk:"links"` - Name types.String `tfsdk:"name"` - Owner *TeamEntity1 `tfsdk:"owner"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` - UpdatedBy *AuthorEntity `tfsdk:"updated_by"` -} diff --git a/internal/provider/types/imports_import_error_entity.go b/internal/provider/types/imports_import_error_entity.go deleted file mode 100644 index 2c24c99..0000000 --- a/internal/provider/types/imports_import_error_entity.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ImportsImportErrorEntity struct { - CreatedAt types.String `tfsdk:"created_at"` - Data *TeamEntity1 `tfsdk:"data"` - ID types.String `tfsdk:"id"` - Message types.String `tfsdk:"message"` - Resource *ImportsImportErrorEntityResourceEntity `tfsdk:"resource"` -} diff --git a/internal/provider/types/imports_import_error_entity_resource_entity.go b/internal/provider/types/imports_import_error_entity_resource_entity.go deleted file mode 100644 index c73dd27..0000000 --- a/internal/provider/types/imports_import_error_entity_resource_entity.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ImportsImportErrorEntityResourceEntity struct { - Name types.String `tfsdk:"name"` - ResourceID types.String `tfsdk:"resource_id"` - ResourceType types.String `tfsdk:"resource_type"` -} diff --git a/internal/provider/types/imports_importable_resource_entity.go b/internal/provider/types/imports_importable_resource_entity.go deleted file mode 100644 index d259db5..0000000 --- a/internal/provider/types/imports_importable_resource_entity.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ImportsImportableResourceEntity struct { - ImportErrors []ImportsImportErrorEntity `tfsdk:"import_errors"` - ImportedAt types.String `tfsdk:"imported_at"` - RemoteID types.String `tfsdk:"remote_id"` - State types.String `tfsdk:"state"` -} diff --git a/internal/provider/types/incident_role_entity.go b/internal/provider/types/incident_role_entity.go deleted file mode 100644 index 3113391..0000000 --- a/internal/provider/types/incident_role_entity.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type IncidentRoleEntity struct { - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - DiscardedAt types.String `tfsdk:"discarded_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Summary types.String `tfsdk:"summary"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/incident_type_entity.go b/internal/provider/types/incident_type_entity.go deleted file mode 100644 index f332c7c..0000000 --- a/internal/provider/types/incident_type_entity.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type IncidentTypeEntity struct { - CreatedAt types.String `tfsdk:"created_at"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Template *IncidentTypeEntityTemplateEntity `tfsdk:"template"` - TemplateValues *IncidentTypeEntityTemplateValuesEntity `tfsdk:"template_values"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/incident_type_entity_template_entity.go b/internal/provider/types/incident_type_entity_template_entity.go deleted file mode 100644 index a4bec91..0000000 --- a/internal/provider/types/incident_type_entity_template_entity.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type IncidentTypeEntityTemplateEntity struct { - CustomFields types.String `tfsdk:"custom_fields"` - CustomerImpactSummary types.String `tfsdk:"customer_impact_summary"` - Description types.String `tfsdk:"description"` - Impacts []IncidentTypeEntityTemplateImpactEntity `tfsdk:"impacts"` - IncidentName types.String `tfsdk:"incident_name"` - Labels map[string]types.String `tfsdk:"labels"` - Priority types.String `tfsdk:"priority"` - PrivateIncident types.Bool `tfsdk:"private_incident"` - RunbookIds []types.String `tfsdk:"runbook_ids"` - Severity types.String `tfsdk:"severity"` - Summary types.String `tfsdk:"summary"` - TagList []types.String `tfsdk:"tag_list"` - TeamIds []types.String `tfsdk:"team_ids"` -} diff --git a/internal/provider/types/incident_type_entity_template_impact_entity.go b/internal/provider/types/incident_type_entity_template_impact_entity.go deleted file mode 100644 index ccad57e..0000000 --- a/internal/provider/types/incident_type_entity_template_impact_entity.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type IncidentTypeEntityTemplateImpactEntity struct { - ConditionID types.String `tfsdk:"condition_id"` - ConditionName types.String `tfsdk:"condition_name"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/incident_type_entity_template_values_entity.go b/internal/provider/types/incident_type_entity_template_values_entity.go deleted file mode 100644 index ec4fe50..0000000 --- a/internal/provider/types/incident_type_entity_template_values_entity.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -type IncidentTypeEntityTemplateValuesEntity struct { - Environments []IncidentTypeEntityTemplateImpactEntity `tfsdk:"environments"` - Functionalities []IncidentTypeEntityTemplateImpactEntity `tfsdk:"functionalities"` - Runbooks *TeamEntity1 `tfsdk:"runbooks"` - Services []IncidentTypeEntityTemplateImpactEntity `tfsdk:"services"` - Teams []TeamEntity `tfsdk:"teams"` -} diff --git a/internal/provider/types/integrations_microsoft_teams_v2_channel_entity.go b/internal/provider/types/integrations_microsoft_teams_v2_channel_entity.go deleted file mode 100644 index e5c7069..0000000 --- a/internal/provider/types/integrations_microsoft_teams_v2_channel_entity.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type IntegrationsMicrosoftTeamsV2ChannelEntity struct { - ChannelID types.String `tfsdk:"channel_id"` - ChannelName types.String `tfsdk:"channel_name"` - ChannelURL types.String `tfsdk:"channel_url"` - ID types.String `tfsdk:"id"` - MsTeamID types.String `tfsdk:"ms_team_id"` - Status types.String `tfsdk:"status"` - TeamName types.String `tfsdk:"team_name"` -} diff --git a/internal/provider/types/integrations_slack_slack_channel_entity.go b/internal/provider/types/integrations_slack_slack_channel_entity.go deleted file mode 100644 index 3a6fedc..0000000 --- a/internal/provider/types/integrations_slack_slack_channel_entity.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type IntegrationsSlackSlackChannelEntity struct { - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - SlackChannelID types.String `tfsdk:"slack_channel_id"` -} diff --git a/internal/provider/types/links_entity.go b/internal/provider/types/links_entity.go deleted file mode 100644 index 3129ee0..0000000 --- a/internal/provider/types/links_entity.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type LinksEntity struct { - HrefURL types.String `tfsdk:"href_url"` - IconURL types.String `tfsdk:"icon_url"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` -} diff --git a/internal/provider/types/links_entity1.go b/internal/provider/types/links_entity1.go deleted file mode 100644 index 2c11e98..0000000 --- a/internal/provider/types/links_entity1.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type LinksEntity1 struct { - HrefURL types.String `tfsdk:"href_url"` - IconURL types.String `tfsdk:"icon_url"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` -} diff --git a/internal/provider/types/membership_entity.go b/internal/provider/types/membership_entity.go deleted file mode 100644 index 6f0715c..0000000 --- a/internal/provider/types/membership_entity.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -type MembershipEntity struct { - DefaultIncidentRole *IncidentRoleEntity `tfsdk:"default_incident_role"` - Schedule *ScheduleEntity `tfsdk:"schedule"` - User *UserEntity `tfsdk:"user"` -} diff --git a/internal/provider/types/memberships.go b/internal/provider/types/memberships.go deleted file mode 100644 index c2d4c1f..0000000 --- a/internal/provider/types/memberships.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Memberships struct { - DefaultIncidentRole *IncidentRoleEntity `tfsdk:"default_incident_role"` - IncidentRoleID types.String `tfsdk:"incident_role_id"` - Schedule *ScheduleEntity `tfsdk:"schedule"` - ScheduleID types.String `tfsdk:"schedule_id"` - User *UserEntity `tfsdk:"user"` - UserID types.String `tfsdk:"user_id"` -} diff --git a/internal/provider/types/ms_teams_channel.go b/internal/provider/types/ms_teams_channel.go deleted file mode 100644 index 63f7be8..0000000 --- a/internal/provider/types/ms_teams_channel.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type MsTeamsChannel struct { - ChannelID types.String `tfsdk:"channel_id"` - ChannelName types.String `tfsdk:"channel_name"` - ChannelURL types.String `tfsdk:"channel_url"` - ID types.String `tfsdk:"id"` - MsTeamID types.String `tfsdk:"ms_team_id"` - Status types.String `tfsdk:"status"` - TeamName types.String `tfsdk:"team_name"` -} diff --git a/internal/provider/types/owner.go b/internal/provider/types/owner.go deleted file mode 100644 index fd294f8..0000000 --- a/internal/provider/types/owner.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Owner struct { - CreatedAt types.String `tfsdk:"created_at"` - CreatedBy *AuthorEntity `tfsdk:"created_by"` - Description types.String `tfsdk:"description"` - Functionalities []FunctionalityEntity `tfsdk:"functionalities"` - ID types.String `tfsdk:"id"` - Memberships []MembershipEntity `tfsdk:"memberships"` - MsTeamsChannel *IntegrationsMicrosoftTeamsV2ChannelEntity `tfsdk:"ms_teams_channel"` - Name types.String `tfsdk:"name"` - OwnedFunctionalities []FunctionalityEntity `tfsdk:"owned_functionalities"` - OwnedRunbooks []SlimRunbookEntity `tfsdk:"owned_runbooks"` - SignalsIcalURL types.String `tfsdk:"signals_ical_url"` - SlackChannel *IntegrationsSlackSlackChannelEntity `tfsdk:"slack_channel"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/pagination_entity.go b/internal/provider/types/pagination_entity.go deleted file mode 100644 index 5b229b2..0000000 --- a/internal/provider/types/pagination_entity.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type PaginationEntity struct { - Count types.Int64 `tfsdk:"count"` - Items types.Int64 `tfsdk:"items"` - Last types.Int64 `tfsdk:"last"` - Next types.Int64 `tfsdk:"next"` - Page types.Int64 `tfsdk:"page"` - Pages types.Int64 `tfsdk:"pages"` - Prev types.Int64 `tfsdk:"prev"` -} diff --git a/internal/provider/types/post_v1_functionalities_owner.go b/internal/provider/types/post_v1_functionalities_owner.go deleted file mode 100644 index 16e2ee0..0000000 --- a/internal/provider/types/post_v1_functionalities_owner.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type PostV1FunctionalitiesOwner struct { - ID types.String `tfsdk:"id"` -} diff --git a/internal/provider/types/post_v1_incident_types_impacts.go b/internal/provider/types/post_v1_incident_types_impacts.go deleted file mode 100644 index 2771fc2..0000000 --- a/internal/provider/types/post_v1_incident_types_impacts.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type PostV1IncidentTypesImpacts struct { - ConditionID types.String `tfsdk:"condition_id"` - ConditionName types.String `tfsdk:"condition_name"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/post_v1_runbooks_steps.go b/internal/provider/types/post_v1_runbooks_steps.go deleted file mode 100644 index ee65b26..0000000 --- a/internal/provider/types/post_v1_runbooks_steps.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type PostV1RunbooksSteps struct { - ActionID types.String `tfsdk:"action_id"` - Name types.String `tfsdk:"name"` - Rule *AttachmentRule `tfsdk:"rule"` -} diff --git a/internal/provider/types/rules_rule_entity.go b/internal/provider/types/rules_rule_entity.go deleted file mode 100644 index 62849a4..0000000 --- a/internal/provider/types/rules_rule_entity.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -type RulesRuleEntity struct { - Logic *TeamEntity1 `tfsdk:"logic"` - UserData *FHTypesGenericEntity `tfsdk:"user_data"` -} diff --git a/internal/provider/types/schedule_entity.go b/internal/provider/types/schedule_entity.go deleted file mode 100644 index d4047f2..0000000 --- a/internal/provider/types/schedule_entity.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ScheduleEntity struct { - Discarded types.Bool `tfsdk:"discarded"` - ID types.String `tfsdk:"id"` - Integration types.String `tfsdk:"integration"` - Name types.String `tfsdk:"name"` -} diff --git a/internal/provider/types/service_entity.go b/internal/provider/types/service_entity.go deleted file mode 100644 index e9ce4e5..0000000 --- a/internal/provider/types/service_entity.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ServiceEntity struct { - ActiveIncidents []types.String `tfsdk:"active_incidents"` - AlertOnAdd types.Bool `tfsdk:"alert_on_add"` - AllowedParams []types.String `tfsdk:"allowed_params"` - AutoAddRespondingTeam types.Bool `tfsdk:"auto_add_responding_team"` - Checklists []Checklists `tfsdk:"checklists"` - CompletedChecks types.Int64 `tfsdk:"completed_checks"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ExternalResources []ExternalResourceEntity `tfsdk:"external_resources"` - Functionalities []FunctionalityEntity `tfsdk:"functionalities"` - ID types.String `tfsdk:"id"` - Labels map[string]types.String `tfsdk:"labels"` - LastImport *ImportsImportableResourceEntity `tfsdk:"last_import"` - Links []LinksEntity `tfsdk:"links"` - ManagedBy types.String `tfsdk:"managed_by"` - ManagedBySettings *TeamEntity1 `tfsdk:"managed_by_settings"` - Name types.String `tfsdk:"name"` - Owner *TeamEntity `tfsdk:"owner"` - ServiceChecklistUpdatedAt types.String `tfsdk:"service_checklist_updated_at"` - ServiceTier types.Int64 `tfsdk:"service_tier"` - Slug types.String `tfsdk:"slug"` - Teams []TeamEntity `tfsdk:"teams"` - UpdatedAt types.String `tfsdk:"updated_at"` - UpdatedBy *AuthorEntity `tfsdk:"updated_by"` -} diff --git a/internal/provider/types/severity_entity.go b/internal/provider/types/severity_entity.go deleted file mode 100644 index 7c48592..0000000 --- a/internal/provider/types/severity_entity.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type SeverityEntity struct { - Color types.String `tfsdk:"color"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - Position types.Int64 `tfsdk:"position"` - Slug types.String `tfsdk:"slug"` - SystemRecord types.Bool `tfsdk:"system_record"` - Type types.String `tfsdk:"type"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/slim_runbook_entity.go b/internal/provider/types/slim_runbook_entity.go deleted file mode 100644 index 6e61140..0000000 --- a/internal/provider/types/slim_runbook_entity.go +++ /dev/null @@ -1,18 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type SlimRunbookEntity struct { - AttachmentRule *RulesRuleEntity `tfsdk:"attachment_rule"` - Categories types.String `tfsdk:"categories"` - CreatedAt types.String `tfsdk:"created_at"` - Description types.String `tfsdk:"description"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Owner *TeamEntity1 `tfsdk:"owner"` - Summary types.String `tfsdk:"summary"` - Type types.String `tfsdk:"type"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/task_list_items.go b/internal/provider/types/task_list_items.go deleted file mode 100644 index 318887d..0000000 --- a/internal/provider/types/task_list_items.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type TaskListItems struct { - Description types.String `tfsdk:"description"` - Summary types.String `tfsdk:"summary"` -} diff --git a/internal/provider/types/team_entity.go b/internal/provider/types/team_entity.go deleted file mode 100644 index d5b9681..0000000 --- a/internal/provider/types/team_entity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type TeamEntity struct { - CreatedAt types.String `tfsdk:"created_at"` - CreatedBy *AuthorEntity `tfsdk:"created_by"` - Description types.String `tfsdk:"description"` - Functionalities []FunctionalityEntity `tfsdk:"functionalities"` - ID types.String `tfsdk:"id"` - Memberships []MembershipEntity `tfsdk:"memberships"` - MsTeamsChannel *IntegrationsMicrosoftTeamsV2ChannelEntity `tfsdk:"ms_teams_channel"` - Name types.String `tfsdk:"name"` - OwnedFunctionalities []FunctionalityEntity `tfsdk:"owned_functionalities"` - OwnedRunbooks []SlimRunbookEntity `tfsdk:"owned_runbooks"` - SignalsIcalURL types.String `tfsdk:"signals_ical_url"` - SlackChannel *IntegrationsSlackSlackChannelEntity `tfsdk:"slack_channel"` - Slug types.String `tfsdk:"slug"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/types/team_entity1.go b/internal/provider/types/team_entity1.go deleted file mode 100644 index affcb11..0000000 --- a/internal/provider/types/team_entity1.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -type TeamEntity1 struct { -} diff --git a/internal/provider/types/template.go b/internal/provider/types/template.go deleted file mode 100644 index 4b55eb3..0000000 --- a/internal/provider/types/template.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Template struct { - CustomFields types.String `tfsdk:"custom_fields"` - CustomerImpactSummary types.String `tfsdk:"customer_impact_summary"` - Description types.String `tfsdk:"description"` - Impacts []PostV1IncidentTypesImpacts `tfsdk:"impacts"` - IncidentName types.String `tfsdk:"incident_name"` - Labels map[string]types.String `tfsdk:"labels"` - Priority types.String `tfsdk:"priority"` - PrivateIncident types.Bool `tfsdk:"private_incident"` - RunbookIds []types.String `tfsdk:"runbook_ids"` - Severity types.String `tfsdk:"severity"` - Summary types.String `tfsdk:"summary"` - TagList []types.String `tfsdk:"tag_list"` - TeamIds []types.String `tfsdk:"team_ids"` -} diff --git a/internal/provider/types/user_entity.go b/internal/provider/types/user_entity.go deleted file mode 100644 index 27331db..0000000 --- a/internal/provider/types/user_entity.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type UserEntity struct { - CreatedAt types.String `tfsdk:"created_at"` - Email types.String `tfsdk:"email"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - SignalsEnabledNotificationTypes []types.String `tfsdk:"signals_enabled_notification_types"` - SlackLinked types.Bool `tfsdk:"slack_linked"` - SlackUserID types.String `tfsdk:"slack_user_id"` - UpdatedAt types.String `tfsdk:"updated_at"` -} diff --git a/internal/provider/users_data_source.go b/internal/provider/users_data_source.go deleted file mode 100644 index 6314df4..0000000 --- a/internal/provider/users_data_source.go +++ /dev/null @@ -1,223 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &UsersDataSource{} -var _ datasource.DataSourceWithConfigure = &UsersDataSource{} - -func NewUsersDataSource() datasource.DataSource { - return &UsersDataSource{} -} - -// UsersDataSource is the data source implementation. -type UsersDataSource struct { - client *sdk.Firehydrant -} - -// UsersDataSourceModel describes the data model. -type UsersDataSourceModel struct { - Data []tfTypes.UserEntity `tfsdk:"data"` - Name types.String `tfsdk:"name"` - Page types.Int64 `tfsdk:"page"` - Pagination *tfTypes.PaginationEntity `tfsdk:"pagination"` - PerPage types.Int64 `tfsdk:"per_page"` - Query types.String `tfsdk:"query"` -} - -// Metadata returns the data source type name. -func (r *UsersDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_users" -} - -// Schema defines the schema for the data source. -func (r *UsersDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Users DataSource", - - Attributes: map[string]schema.Attribute{ - "data": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "signals_enabled_notification_types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "slack_linked": schema.BoolAttribute{ - Computed: true, - }, - "slack_user_id": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - "name": schema.StringAttribute{ - Optional: true, - Description: `Text string of a query to filter users by name`, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "pagination": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "count": schema.Int64Attribute{ - Computed: true, - }, - "items": schema.Int64Attribute{ - Computed: true, - }, - "last": schema.Int64Attribute{ - Computed: true, - }, - "next": schema.Int64Attribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Computed: true, - }, - "pages": schema.Int64Attribute{ - Computed: true, - }, - "prev": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "query": schema.StringAttribute{ - Optional: true, - Description: `Text string of a query to filter users by name or email`, - }, - }, - } -} - -func (r *UsersDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *UsersDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *UsersDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - query := new(string) - if !data.Query.IsUnknown() && !data.Query.IsNull() { - *query = data.Query.ValueString() - } else { - query = nil - } - name := new(string) - if !data.Name.IsUnknown() && !data.Name.IsNull() { - *name = data.Name.ValueString() - } else { - name = nil - } - request := operations.GetV1UsersRequest{ - Page: page, - PerPage: perPage, - Query: query, - Name: name, - } - res, err := r.client.Users.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.UserEntityPaginated != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedUserEntityPaginated(res.UserEntityPaginated) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/users_data_source_sdk.go b/internal/provider/users_data_source_sdk.go deleted file mode 100644 index 9e8ca5b..0000000 --- a/internal/provider/users_data_source_sdk.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "time" -) - -func (r *UsersDataSourceModel) RefreshFromSharedUserEntityPaginated(resp *shared.UserEntityPaginated) { - if resp != nil { - r.Data = []tfTypes.UserEntity{} - if len(r.Data) > len(resp.Data) { - r.Data = r.Data[:len(resp.Data)] - } - for dataCount, dataItem := range resp.Data { - var data1 tfTypes.UserEntity - if dataItem.CreatedAt != nil { - data1.CreatedAt = types.StringValue(dataItem.CreatedAt.Format(time.RFC3339Nano)) - } else { - data1.CreatedAt = types.StringNull() - } - data1.Email = types.StringPointerValue(dataItem.Email) - data1.ID = types.StringPointerValue(dataItem.ID) - data1.Name = types.StringPointerValue(dataItem.Name) - data1.SignalsEnabledNotificationTypes = []types.String{} - for _, v := range dataItem.SignalsEnabledNotificationTypes { - data1.SignalsEnabledNotificationTypes = append(data1.SignalsEnabledNotificationTypes, types.StringValue(v)) - } - data1.SlackLinked = types.BoolPointerValue(dataItem.SlackLinked) - data1.SlackUserID = types.StringPointerValue(dataItem.SlackUserID) - if dataItem.UpdatedAt != nil { - data1.UpdatedAt = types.StringValue(dataItem.UpdatedAt.Format(time.RFC3339Nano)) - } else { - data1.UpdatedAt = types.StringNull() - } - if dataCount+1 > len(r.Data) { - r.Data = append(r.Data, data1) - } else { - r.Data[dataCount].CreatedAt = data1.CreatedAt - r.Data[dataCount].Email = data1.Email - r.Data[dataCount].ID = data1.ID - r.Data[dataCount].Name = data1.Name - r.Data[dataCount].SignalsEnabledNotificationTypes = data1.SignalsEnabledNotificationTypes - r.Data[dataCount].SlackLinked = data1.SlackLinked - r.Data[dataCount].SlackUserID = data1.SlackUserID - r.Data[dataCount].UpdatedAt = data1.UpdatedAt - } - } - if resp.Pagination == nil { - r.Pagination = nil - } else { - r.Pagination = &tfTypes.PaginationEntity{} - if resp.Pagination.Count != nil { - r.Pagination.Count = types.Int64Value(int64(*resp.Pagination.Count)) - } else { - r.Pagination.Count = types.Int64Null() - } - if resp.Pagination.Items != nil { - r.Pagination.Items = types.Int64Value(int64(*resp.Pagination.Items)) - } else { - r.Pagination.Items = types.Int64Null() - } - if resp.Pagination.Last != nil { - r.Pagination.Last = types.Int64Value(int64(*resp.Pagination.Last)) - } else { - r.Pagination.Last = types.Int64Null() - } - if resp.Pagination.Next != nil { - r.Pagination.Next = types.Int64Value(int64(*resp.Pagination.Next)) - } else { - r.Pagination.Next = types.Int64Null() - } - if resp.Pagination.Page != nil { - r.Pagination.Page = types.Int64Value(int64(*resp.Pagination.Page)) - } else { - r.Pagination.Page = types.Int64Null() - } - if resp.Pagination.Pages != nil { - r.Pagination.Pages = types.Int64Value(int64(*resp.Pagination.Pages)) - } else { - r.Pagination.Pages = types.Int64Null() - } - if resp.Pagination.Prev != nil { - r.Pagination.Prev = types.Int64Value(int64(*resp.Pagination.Prev)) - } else { - r.Pagination.Prev = types.Int64Null() - } - } - } -} diff --git a/internal/provider/utils.go b/internal/provider/utils.go deleted file mode 100644 index 481a309..0000000 --- a/internal/provider/utils.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "encoding/json" - "fmt" - tfReflect "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/reflect" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/types" - "net/http" - "net/http/httputil" - "reflect" -) - -func debugResponse(response *http.Response) string { - if v := response.Request.Header.Get("Authorization"); v != "" { - response.Request.Header.Set("Authorization", "(sensitive)") - } - dumpReq, err := httputil.DumpRequest(response.Request, true) - if err != nil { - dumpReq, err = httputil.DumpRequest(response.Request, false) - if err != nil { - return err.Error() - } - } - dumpRes, err := httputil.DumpResponse(response, true) - if err != nil { - dumpRes, err = httputil.DumpResponse(response, false) - if err != nil { - return err.Error() - } - } - return fmt.Sprintf("**Request**:\n%s\n**Response**:\n%s", string(dumpReq), string(dumpRes)) -} - -func reflectJSONKey(data any, key string) reflect.Value { - jsonIfied, err := json.Marshal(data) - if err != nil { - panic(fmt.Errorf("failed to marshal data: %w", err)) - } - var jsonMap map[string]interface{} - err = json.Unmarshal(jsonIfied, &jsonMap) - if err != nil { - panic(fmt.Errorf("failed to unmarshal data: %w", err)) - } - return reflect.ValueOf(jsonMap[key]) -} - -func merge(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse, target interface{}) { - var plan types.Object - var state types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - if resp.Diagnostics.HasError() { - return - } - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - val, err := state.ToTerraformValue(ctx) - if err != nil { - resp.Diagnostics.Append(diag.NewErrorDiagnostic("Object Conversion Error", "An unexpected error was encountered trying to convert object. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error())) - return - } - resp.Diagnostics.Append(tfReflect.Into(ctx, types.ObjectType{AttrTypes: state.AttributeTypes(ctx)}, val, target, tfReflect.Options{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - }, path.Empty())...) - if resp.Diagnostics.HasError() { - return - } - - refreshPlan(ctx, plan, target, resp.Diagnostics) -} - -func refreshPlan(ctx context.Context, plan types.Object, target interface{}, diagnostics diag.Diagnostics) { - obj := types.ObjectType{AttrTypes: plan.AttributeTypes(ctx)} - val, err := plan.ToTerraformValue(ctx) - if err != nil { - diagnostics.Append(diag.NewErrorDiagnostic("Object Conversion Error", "An unexpected error was encountered trying to convert object. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error())) - return - } - diagnostics.Append(tfReflect.Into(ctx, obj, val, target, tfReflect.Options{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - SourceType: tfReflect.SourceTypePlan, - }, path.Empty())...) -} diff --git a/internal/provider/webhook_data_source.go b/internal/provider/webhook_data_source.go deleted file mode 100644 index a5d40f4..0000000 --- a/internal/provider/webhook_data_source.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &WebhookDataSource{} -var _ datasource.DataSourceWithConfigure = &WebhookDataSource{} - -func NewWebhookDataSource() datasource.DataSource { - return &WebhookDataSource{} -} - -// WebhookDataSource is the data source implementation. -type WebhookDataSource struct { - client *sdk.Firehydrant -} - -// WebhookDataSourceModel describes the data model. -type WebhookDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Email types.String `tfsdk:"email"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Source types.String `tfsdk:"source"` - State types.String `tfsdk:"state"` - Subscriptions types.String `tfsdk:"subscriptions"` - UpdatedAt types.String `tfsdk:"updated_at"` - URL types.String `tfsdk:"url"` -} - -// Metadata returns the data source type name. -func (r *WebhookDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_webhook" -} - -// Schema defines the schema for the data source. -func (r *WebhookDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Webhook DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - }, - "subscriptions": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "url": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *WebhookDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *WebhookDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *WebhookDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var webhookID string - webhookID = data.ID.ValueString() - - request := operations.GetV1WebhooksWebhookIDRequest{ - WebhookID: webhookID, - } - res, err := r.client.Webhooks.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/webhook_data_source_sdk.go b/internal/provider/webhook_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/webhook_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/webhook_resource.go b/internal/provider/webhook_resource.go deleted file mode 100644 index 91580ef..0000000 --- a/internal/provider/webhook_resource.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/validators" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &WebhookResource{} -var _ resource.ResourceWithImportState = &WebhookResource{} - -func NewWebhookResource() resource.Resource { - return &WebhookResource{} -} - -// WebhookResource defines the resource implementation. -type WebhookResource struct { - client *sdk.Firehydrant -} - -// WebhookResourceModel describes the resource data model. -type WebhookResourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Email types.String `tfsdk:"email"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Source types.String `tfsdk:"source"` - State types.String `tfsdk:"state"` - Subscriptions types.String `tfsdk:"subscriptions"` - UpdatedAt types.String `tfsdk:"updated_at"` - URL types.String `tfsdk:"url"` -} - -func (r *WebhookResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_webhook" -} - -func (r *WebhookResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Webhook Resource", - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - }, - "subscriptions": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - Validators: []validator.String{ - validators.IsRFC3339(), - }, - }, - "url": schema.StringAttribute{ - Required: true, - }, - }, - } -} - -func (r *WebhookResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *WebhookResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *WebhookResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - request := *data.ToSharedPostV1Webhooks() - res, err := r.client.Webhooks.Create(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 201 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *WebhookResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *WebhookResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var webhookID string - webhookID = data.ID.ValueString() - - request := operations.GetV1WebhooksWebhookIDRequest{ - WebhookID: webhookID, - } - res, err := r.client.Webhooks.Get(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *WebhookResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *WebhookResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - var webhookID string - webhookID = data.ID.ValueString() - - patchV1WebhooksWebhookID := *data.ToSharedPatchV1WebhooksWebhookID() - request := operations.PatchV1WebhooksWebhookIDRequest{ - WebhookID: webhookID, - PatchV1WebhooksWebhookID: patchV1WebhooksWebhookID, - } - res, err := r.client.Webhooks.Update(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *WebhookResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *WebhookResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var webhookID string - webhookID = data.ID.ValueString() - - request := operations.DeleteV1WebhooksWebhookIDRequest{ - WebhookID: webhookID, - } - res, err := r.client.Webhooks.Delete(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 204 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - -} - -func (r *WebhookResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/webhook_resource_sdk.go b/internal/provider/webhook_resource_sdk.go deleted file mode 100644 index b6f1b2d..0000000 --- a/internal/provider/webhook_resource_sdk.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" -) - -func (r *WebhookResourceModel) ToSharedPostV1Webhooks() *shared.PostV1Webhooks { - var url string - url = r.URL.ValueString() - - out := shared.PostV1Webhooks{ - URL: url, - } - return &out -} - -func (r *WebhookResourceModel) ToSharedPatchV1WebhooksWebhookID() *shared.PatchV1WebhooksWebhookID { - url := new(string) - if !r.URL.IsUnknown() && !r.URL.IsNull() { - *url = r.URL.ValueString() - } else { - url = nil - } - state := new(shared.PatchV1WebhooksWebhookIDState) - if !r.State.IsUnknown() && !r.State.IsNull() { - *state = shared.PatchV1WebhooksWebhookIDState(r.State.ValueString()) - } else { - state = nil - } - out := shared.PatchV1WebhooksWebhookID{ - URL: url, - State: state, - } - return &out -} diff --git a/internal/provider/webhooks_data_source.go b/internal/provider/webhooks_data_source.go deleted file mode 100644 index db2c9d6..0000000 --- a/internal/provider/webhooks_data_source.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &WebhooksDataSource{} -var _ datasource.DataSourceWithConfigure = &WebhooksDataSource{} - -func NewWebhooksDataSource() datasource.DataSource { - return &WebhooksDataSource{} -} - -// WebhooksDataSource is the data source implementation. -type WebhooksDataSource struct { - client *sdk.Firehydrant -} - -// WebhooksDataSourceModel describes the data model. -type WebhooksDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - Email types.String `tfsdk:"email"` - ID types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Page types.Int64 `tfsdk:"page"` - PerPage types.Int64 `tfsdk:"per_page"` - Source types.String `tfsdk:"source"` - State types.String `tfsdk:"state"` - Subscriptions types.String `tfsdk:"subscriptions"` - UpdatedAt types.String `tfsdk:"updated_at"` - URL types.String `tfsdk:"url"` -} - -// Metadata returns the data source type name. -func (r *WebhooksDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_webhooks" -} - -// Schema defines the schema for the data source. -func (r *WebhooksDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "Webhooks DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "page": schema.Int64Attribute{ - Optional: true, - }, - "per_page": schema.Int64Attribute{ - Optional: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - "state": schema.StringAttribute{ - Computed: true, - }, - "subscriptions": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "url": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *WebhooksDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *WebhooksDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *WebhooksDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - page := new(int) - if !data.Page.IsUnknown() && !data.Page.IsNull() { - *page = int(data.Page.ValueInt64()) - } else { - page = nil - } - perPage := new(int) - if !data.PerPage.IsUnknown() && !data.PerPage.IsNull() { - *perPage = int(data.PerPage.ValueInt64()) - } else { - perPage = nil - } - request := operations.GetV1WebhooksRequest{ - Page: page, - PerPage: perPage, - } - res, err := r.client.Webhooks.List(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/webhooks_data_source_sdk.go b/internal/provider/webhooks_data_source_sdk.go deleted file mode 100644 index 960c2ca..0000000 --- a/internal/provider/webhooks_data_source_sdk.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider diff --git a/internal/provider/webhooktarget_data_source.go b/internal/provider/webhooktarget_data_source.go deleted file mode 100644 index b2080e4..0000000 --- a/internal/provider/webhooktarget_data_source.go +++ /dev/null @@ -1,163 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &WebhookTargetDataSource{} -var _ datasource.DataSourceWithConfigure = &WebhookTargetDataSource{} - -func NewWebhookTargetDataSource() datasource.DataSource { - return &WebhookTargetDataSource{} -} - -// WebhookTargetDataSource is the data source implementation. -type WebhookTargetDataSource struct { - client *sdk.Firehydrant -} - -// WebhookTargetDataSourceModel describes the data model. -type WebhookTargetDataSourceModel struct { - CreatedAt types.String `tfsdk:"created_at"` - CreatedBy *tfTypes.AuthorEntity `tfsdk:"created_by"` - ID types.String `tfsdk:"id"` - State types.String `tfsdk:"state"` - Subscriptions types.String `tfsdk:"subscriptions"` - UpdatedAt types.String `tfsdk:"updated_at"` - URL types.String `tfsdk:"url"` -} - -// Metadata returns the data source type name. -func (r *WebhookTargetDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_webhook_target" -} - -// Schema defines the schema for the data source. -func (r *WebhookTargetDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "WebhookTarget DataSource", - - Attributes: map[string]schema.Attribute{ - "created_at": schema.StringAttribute{ - Computed: true, - }, - "created_by": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "email": schema.StringAttribute{ - Computed: true, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "name": schema.StringAttribute{ - Computed: true, - }, - "source": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "id": schema.StringAttribute{ - Required: true, - }, - "state": schema.StringAttribute{ - Computed: true, - }, - "subscriptions": schema.StringAttribute{ - Computed: true, - }, - "updated_at": schema.StringAttribute{ - Computed: true, - }, - "url": schema.StringAttribute{ - Computed: true, - }, - }, - } -} - -func (r *WebhookTargetDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.Firehydrant) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.Firehydrant, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *WebhookTargetDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *WebhookTargetDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - var id string - id = data.ID.ValueString() - - request := operations.GetV1SignalsWebhookTargetsIDRequest{ - ID: id, - } - res, err := r.client.Signals.GetWebhookTarget(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode == 404 { - resp.State.RemoveResource(ctx) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if !(res.Object != nil) { - resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromOperationsGetV1SignalsWebhookTargetsIDResponseBody(res.Object) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/webhooktarget_data_source_sdk.go b/internal/provider/webhooktarget_data_source_sdk.go deleted file mode 100644 index 9546837..0000000 --- a/internal/provider/webhooktarget_data_source_sdk.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package provider - -import ( - tfTypes "github.com/firehydrant/terraform-provider-firehydrant/internal/provider/types" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/hashicorp/terraform-plugin-framework/types" -) - -func (r *WebhookTargetDataSourceModel) RefreshFromOperationsGetV1SignalsWebhookTargetsIDResponseBody(resp *operations.GetV1SignalsWebhookTargetsIDResponseBody) { - if resp != nil { - r.CreatedAt = types.StringPointerValue(resp.CreatedAt) - if resp.CreatedBy == nil { - r.CreatedBy = nil - } else { - r.CreatedBy = &tfTypes.AuthorEntity{} - r.CreatedBy.Email = types.StringPointerValue(resp.CreatedBy.Email) - r.CreatedBy.ID = types.StringPointerValue(resp.CreatedBy.ID) - r.CreatedBy.Name = types.StringPointerValue(resp.CreatedBy.Name) - r.CreatedBy.Source = types.StringPointerValue(resp.CreatedBy.Source) - } - r.ID = types.StringPointerValue(resp.ID) - r.State = types.StringPointerValue(resp.State) - r.Subscriptions = types.StringPointerValue(resp.Subscriptions) - r.UpdatedAt = types.StringPointerValue(resp.UpdatedAt) - r.URL = types.StringPointerValue(resp.URL) - } -} diff --git a/internal/sdk/.gitattributes b/internal/sdk/.gitattributes deleted file mode 100644 index e6a9944..0000000 --- a/internal/sdk/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# This allows generated code to be indexed correctly -*.go linguist-generated=false \ No newline at end of file diff --git a/internal/sdk/.gitignore b/internal/sdk/.gitignore deleted file mode 100644 index d3c2f59..0000000 --- a/internal/sdk/.gitignore +++ /dev/null @@ -1 +0,0 @@ -# .gitignore diff --git a/internal/sdk/CONTRIBUTING.md b/internal/sdk/CONTRIBUTING.md deleted file mode 100644 index d585717..0000000 --- a/internal/sdk/CONTRIBUTING.md +++ /dev/null @@ -1,26 +0,0 @@ -# Contributing to This Repository - -Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. - -## How to Report Issues - -If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: - -- A clear and descriptive title -- Steps to reproduce the issue -- Expected and actual behavior -- Any relevant logs, screenshots, or error messages -- Information about your environment (e.g., operating system, software versions) - - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed - -## Issue Triage and Upstream Fixes - -We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. - -## Contact - -If you have any questions or need further assistance, please feel free to reach out by opening an issue. - -Thank you for your understanding and cooperation! - -The Maintainers diff --git a/internal/sdk/ai.go b/internal/sdk/ai.go deleted file mode 100644 index ed1effa..0000000 --- a/internal/sdk/ai.go +++ /dev/null @@ -1,467 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Ai - Operations about ais -type Ai struct { - sdkConfiguration sdkConfiguration -} - -func newAi(sdkConfig sdkConfiguration) *Ai { - return &Ai{ - sdkConfiguration: sdkConfig, - } -} - -func (s *Ai) GetSummaryVote(ctx context.Context, request operations.GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedRequest, opts ...operations.Option) (*operations.GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1AiSummarizeIncidentIncidentIdGeneratedSummaryIdVoted", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ai/summarize_incident/{incident_id}/{generated_summary_id}/voted", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Ai) SubmitSummaryVote(ctx context.Context, request operations.PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequest, opts ...operations.Option) (*operations.PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1AiSummarizeIncidentIncidentIdGeneratedSummaryIdVote", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ai/summarize_incident/{incident_id}/{generated_summary_id}/vote", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdatePreferences - Update preferences -// Updates the AI preferences -func (s *Ai) UpdatePreferences(ctx context.Context, request *operations.PatchV1AiPreferencesRequestBody, opts ...operations.Option) (*operations.PatchV1AiPreferencesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1AiPreferences", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ai/preferences") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1AiPreferencesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.AIEntitiesPreferencesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.AIEntitiesPreferencesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetPreferences - Preferences -// Retrieves the current AI preferences -func (s *Ai) GetPreferences(ctx context.Context, opts ...operations.Option) (*operations.GetV1AiPreferencesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1AiPreferences", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ai/preferences") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1AiPreferencesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.AIEntitiesPreferencesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.AIEntitiesPreferencesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/alerts.go b/internal/sdk/alerts.go deleted file mode 100644 index a54269e..0000000 --- a/internal/sdk/alerts.go +++ /dev/null @@ -1,267 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Alerts - Operations about alerts -type Alerts struct { - sdkConfiguration sdkConfiguration -} - -func newAlerts(sdkConfig sdkConfiguration) *Alerts { - return &Alerts{ - sdkConfiguration: sdkConfig, - } -} - -// List - Retrieve all alerts -// Retrieve all alerts from third parties -func (s *Alerts) List(ctx context.Context, request operations.GetV1AlertsRequest, opts ...operations.Option) (*operations.GetV1AlertsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Alerts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/alerts") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1AlertsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.AlertsAlertEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.AlertsAlertEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a single alert -// Retrieve a single alert -func (s *Alerts) Get(ctx context.Context, request operations.GetV1AlertsAlertIDRequest, opts ...operations.Option) (*operations.GetV1AlertsAlertIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1AlertsAlertId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/alerts/{alert_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1AlertsAlertIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.AlertsAlertEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.AlertsAlertEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/awsconnections.go b/internal/sdk/awsconnections.go deleted file mode 100644 index 733fd6d..0000000 --- a/internal/sdk/awsconnections.go +++ /dev/null @@ -1,267 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type AwsConnections struct { - sdkConfiguration sdkConfiguration -} - -func newAwsConnections(sdkConfig sdkConfiguration) *AwsConnections { - return &AwsConnections{ - sdkConfiguration: sdkConfig, - } -} - -// Update an AWS connection -// Update the AWS connection with the provided data. -func (s *AwsConnections) Update(ctx context.Context, request operations.PatchV1IntegrationsAwsConnectionsIDRequest, opts ...operations.Option) (*operations.PatchV1IntegrationsAwsConnectionsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IntegrationsAwsConnectionsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/aws/connections/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IntegrationsAwsConnectionsID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IntegrationsAwsConnectionsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsAwsConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsAwsConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve an AWS connection -// Retrieves the information about the AWS connection. -func (s *AwsConnections) Get(ctx context.Context, request operations.GetV1IntegrationsAwsConnectionsIDRequest, opts ...operations.Option) (*operations.GetV1IntegrationsAwsConnectionsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsAwsConnectionsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/aws/connections/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsAwsConnectionsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsAwsConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsAwsConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/bootstrap.go b/internal/sdk/bootstrap.go deleted file mode 100644 index 7e78fcb..0000000 --- a/internal/sdk/bootstrap.go +++ /dev/null @@ -1,123 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" - "net/url" -) - -// Bootstrap - Operations about bootstraps -type Bootstrap struct { - sdkConfiguration sdkConfiguration -} - -func newBootstrap(sdkConfig sdkConfiguration) *Bootstrap { - return &Bootstrap{ - sdkConfiguration: sdkConfig, - } -} - -// Get - Retrieve a single checklist template -// Retrieves a single checklist template by ID -func (s *Bootstrap) Get(ctx context.Context, opts ...operations.Option) (*operations.GetV1BootstrapResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Bootstrap", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/bootstrap") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1BootstrapResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/catalogs.go b/internal/sdk/catalogs.go deleted file mode 100644 index a4fe67f..0000000 --- a/internal/sdk/catalogs.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// Catalogs - Operations about catalogs -type Catalogs struct { - sdkConfiguration sdkConfiguration -} - -func newCatalogs(sdkConfig sdkConfiguration) *Catalogs { - return &Catalogs{ - sdkConfiguration: sdkConfig, - } -} - -// Refresh a catalog. -// Schedules an async task to re-import catalog info and update catalog data accordingly. -func (s *Catalogs) Refresh(ctx context.Context, request operations.GetV1CatalogsCatalogIDRefreshRequest, opts ...operations.Option) (*operations.GetV1CatalogsCatalogIDRefreshResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1CatalogsCatalogIdRefresh", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/catalogs/{catalog_id}/refresh", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1CatalogsCatalogIDRefreshResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Ingest - Accept catalog data in the configured format. -// Accepts catalog data in the configured format and asyncronously processes the data to incorporate changes into service catalog. -func (s *Catalogs) Ingest(ctx context.Context, request operations.PostV1CatalogsCatalogIDIngestRequest, opts ...operations.Option) (*operations.PostV1CatalogsCatalogIDIngestResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1CatalogsCatalogIdIngest", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/catalogs/{catalog_id}/ingest", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1CatalogsCatalogIDIngest", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1CatalogsCatalogIDIngestResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ImportsImportEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ImportsImportEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/changes.go b/internal/sdk/changes.go deleted file mode 100644 index c246f5f..0000000 --- a/internal/sdk/changes.go +++ /dev/null @@ -1,1605 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Changes - Operations about changes -type Changes struct { - sdkConfiguration sdkConfiguration -} - -func newChanges(sdkConfig sdkConfiguration) *Changes { - return &Changes{ - sdkConfiguration: sdkConfig, - } -} - -// Create a new change entry -func (s *Changes) Create(ctx context.Context, request shared.PostV1Changes, opts ...operations.Option) (*operations.PostV1ChangesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Changes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/changes") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ChangesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List - Lists all changes -func (s *Changes) List(ctx context.Context, request operations.GetV1ChangesRequest, opts ...operations.Option) (*operations.GetV1ChangesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Changes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/changes") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ChangesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Archive a change entry -func (s *Changes) Archive(ctx context.Context, request operations.DeleteV1ChangesChangeIDRequest, opts ...operations.Option) (*operations.DeleteV1ChangesChangeIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ChangesChangeId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/{change_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ChangesChangeIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a change entry -func (s *Changes) Update(ctx context.Context, request operations.PatchV1ChangesChangeIDRequest, opts ...operations.Option) (*operations.PatchV1ChangesChangeIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1ChangesChangeId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/{change_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1ChangesChangeID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1ChangesChangeIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateIdentity - Create an identity for this change -func (s *Changes) CreateIdentity(ctx context.Context, request operations.PostV1ChangesChangeIDIdentitiesRequest, opts ...operations.Option) (*operations.PostV1ChangesChangeIDIdentitiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ChangesChangeIdIdentities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/{change_id}/identities", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1ChangesChangeIDIdentities", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ChangesChangeIDIdentitiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeIdentityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeIdentityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListIdentities - Retrieve all identities for the change -func (s *Changes) ListIdentities(ctx context.Context, request operations.GetV1ChangesChangeIDIdentitiesRequest, opts ...operations.Option) (*operations.GetV1ChangesChangeIDIdentitiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ChangesChangeIdIdentities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/{change_id}/identities", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ChangesChangeIDIdentitiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeIdentityEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeIdentityEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteIdentity - Delete an identity -func (s *Changes) DeleteIdentity(ctx context.Context, request operations.DeleteV1ChangesChangeIDIdentitiesIdentityIDRequest, opts ...operations.Option) (*operations.DeleteV1ChangesChangeIDIdentitiesIdentityIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ChangesChangeIdIdentitiesIdentityId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/{change_id}/identities/{identity_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ChangesChangeIDIdentitiesIdentityIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateIdentity - Update an identity -func (s *Changes) UpdateIdentity(ctx context.Context, request operations.PatchV1ChangesChangeIDIdentitiesIdentityIDRequest, opts ...operations.Option) (*operations.PatchV1ChangesChangeIDIdentitiesIdentityIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1ChangesChangeIdIdentitiesIdentityId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/{change_id}/identities/{identity_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1ChangesChangeIDIdentitiesIdentityID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1ChangesChangeIDIdentitiesIdentityIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeIdentityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeIdentityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateEvent - Create a change event -// Create a change event -func (s *Changes) CreateEvent(ctx context.Context, request shared.PostV1ChangesEvents, opts ...operations.Option) (*operations.PostV1ChangesEventsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ChangesEvents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/changes/events") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ChangesEventsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeEventEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeEventEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListEvents - List change events -// List change events for the organization. Note: Not all information is included on a change event like attachments and related changes. You must fetch a change event separately to retrieve all of the information about it -func (s *Changes) ListEvents(ctx context.Context, request operations.GetV1ChangesEventsRequest, opts ...operations.Option) (*operations.GetV1ChangesEventsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ChangesEvents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/changes/events") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ChangesEventsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeEventSlimEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeEventSlimEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteEvent - Delete a change event -// Delete a change event -func (s *Changes) DeleteEvent(ctx context.Context, request operations.DeleteV1ChangesEventsChangeEventIDRequest, opts ...operations.Option) (*operations.DeleteV1ChangesEventsChangeEventIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ChangesEventsChangeEventId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/events/{change_event_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ChangesEventsChangeEventIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateEvent - Update a change event -// Update a change event -func (s *Changes) UpdateEvent(ctx context.Context, request operations.PatchV1ChangesEventsChangeEventIDRequest, opts ...operations.Option) (*operations.PatchV1ChangesEventsChangeEventIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1ChangesEventsChangeEventId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/events/{change_event_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1ChangesEventsChangeEventID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1ChangesEventsChangeEventIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeEventEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeEventEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetEvent - Retrieve a change event -// Retrieve a change event -func (s *Changes) GetEvent(ctx context.Context, request operations.GetV1ChangesEventsChangeEventIDRequest, opts ...operations.Option) (*operations.GetV1ChangesEventsChangeEventIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ChangesEventsChangeEventId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/changes/events/{change_event_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ChangesEventsChangeEventIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeEventEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeEventEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/changetypes.go b/internal/sdk/changetypes.go deleted file mode 100644 index 93e5630..0000000 --- a/internal/sdk/changetypes.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// ChangeTypes - Operations about change_types -type ChangeTypes struct { - sdkConfiguration sdkConfiguration -} - -func newChangeTypes(sdkConfig sdkConfiguration) *ChangeTypes { - return &ChangeTypes{ - sdkConfiguration: sdkConfig, - } -} - -// List - Lists all change types -func (s *ChangeTypes) List(ctx context.Context, request operations.GetV1ChangeTypesRequest, opts ...operations.Option) (*operations.GetV1ChangeTypesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ChangeTypes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/change_types") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ChangeTypesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChangeTypeEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChangeTypeEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/checklisttemplates.go b/internal/sdk/checklisttemplates.go deleted file mode 100644 index 1914119..0000000 --- a/internal/sdk/checklisttemplates.go +++ /dev/null @@ -1,653 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type ChecklistTemplates struct { - sdkConfiguration sdkConfiguration -} - -func newChecklistTemplates(sdkConfig sdkConfiguration) *ChecklistTemplates { - return &ChecklistTemplates{ - sdkConfiguration: sdkConfig, - } -} - -// Create a checklist template -// Creates a checklist template for the organization -func (s *ChecklistTemplates) Create(ctx context.Context, request shared.PostV1ChecklistTemplates, opts ...operations.Option) (*operations.PostV1ChecklistTemplatesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ChecklistTemplates", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/checklist_templates") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ChecklistTemplatesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChecklistTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChecklistTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all checklist templates -// List all of the checklist templates that have been added to the organization -func (s *ChecklistTemplates) List(ctx context.Context, request operations.GetV1ChecklistTemplatesRequest, opts ...operations.Option) (*operations.GetV1ChecklistTemplatesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ChecklistTemplates", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/checklist_templates") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ChecklistTemplatesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChecklistTemplateEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChecklistTemplateEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Archive a checklist template -// Archive a checklist template -func (s *ChecklistTemplates) Archive(ctx context.Context, request operations.DeleteV1ChecklistTemplatesIDRequest, opts ...operations.Option) (*operations.DeleteV1ChecklistTemplatesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ChecklistTemplatesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/checklist_templates/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ChecklistTemplatesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChecklistTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChecklistTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a checklist template -// Update a checklist templates attributes -func (s *ChecklistTemplates) Update(ctx context.Context, request operations.PatchV1ChecklistTemplatesIDRequest, opts ...operations.Option) (*operations.PatchV1ChecklistTemplatesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1ChecklistTemplatesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/checklist_templates/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1ChecklistTemplatesID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1ChecklistTemplatesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChecklistTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChecklistTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a single checklist template -// Retrieves a single checklist template by ID -func (s *ChecklistTemplates) Get(ctx context.Context, request operations.GetV1ChecklistTemplatesIDRequest, opts ...operations.Option) (*operations.GetV1ChecklistTemplatesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ChecklistTemplatesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/checklist_templates/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ChecklistTemplatesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ChecklistTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ChecklistTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/comments.go b/internal/sdk/comments.go deleted file mode 100644 index 88eaae4..0000000 --- a/internal/sdk/comments.go +++ /dev/null @@ -1,327 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type Comments struct { - sdkConfiguration sdkConfiguration -} - -func newComments(sdkConfig sdkConfiguration) *Comments { - return &Comments{ - sdkConfiguration: sdkConfig, - } -} - -// Archive a comment -// ALPHA - Archive a comment -func (s *Comments) Archive(ctx context.Context, request operations.DeleteV1ConversationsConversationIDCommentsCommentIDRequest, opts ...operations.Option) (*operations.DeleteV1ConversationsConversationIDCommentsCommentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ConversationsConversationIdCommentsCommentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/conversations/{conversation_id}/comments/{comment_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ConversationsConversationIDCommentsCommentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Create a comment -// ALPHA - Creates a comment for a project -func (s *Comments) Create(ctx context.Context, request operations.PostV1ConversationsConversationIDCommentsRequest, opts ...operations.Option) (*operations.PostV1ConversationsConversationIDCommentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ConversationsConversationIdComments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/conversations/{conversation_id}/comments", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1ConversationsConversationIDComments", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ConversationsConversationIDCommentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all comments -// ALPHA - List all of the comments that have been added to the organization -func (s *Comments) List(ctx context.Context, request operations.GetV1ConversationsConversationIDCommentsRequest, opts ...operations.Option) (*operations.GetV1ConversationsConversationIDCommentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ConversationsConversationIdComments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/conversations/{conversation_id}/comments", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ConversationsConversationIDCommentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/componentgroups.go b/internal/sdk/componentgroups.go deleted file mode 100644 index 1f0be77..0000000 --- a/internal/sdk/componentgroups.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type ComponentGroups struct { - sdkConfiguration sdkConfiguration -} - -func newComponentGroups(sdkConfig sdkConfiguration) *ComponentGroups { - return &ComponentGroups{ - sdkConfiguration: sdkConfig, - } -} - -// Update a component group to be displayed on a FireHydrant status page -// Update a component group to be displayed on a FireHydrant status page -func (s *ComponentGroups) Update(ctx context.Context, request operations.PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest, opts ...operations.Option) (*operations.PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1NuncConnectionsNuncConnectionIdComponentGroupsGroupId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/component_groups/{group_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/conditions.go b/internal/sdk/conditions.go deleted file mode 100644 index b621027..0000000 --- a/internal/sdk/conditions.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type Conditions struct { - sdkConfiguration sdkConfiguration -} - -func newConditions(sdkConfig sdkConfiguration) *Conditions { - return &Conditions{ - sdkConfiguration: sdkConfig, - } -} - -// Get - Lists conditions -// Lists conditions -func (s *Conditions) Get(ctx context.Context, request operations.GetV1SeverityMatrixConditionsRequest, opts ...operations.Option) (*operations.GetV1SeverityMatrixConditionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SeverityMatrixConditions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/severity_matrix/conditions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SeverityMatrixConditionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixConditionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixConditionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/connections.go b/internal/sdk/connections.go deleted file mode 100644 index 2c9902b..0000000 --- a/internal/sdk/connections.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type Connections struct { - sdkConfiguration sdkConfiguration -} - -func newConnections(sdkConfig sdkConfiguration) *Connections { - return &Connections{ - sdkConfiguration: sdkConfig, - } -} - -// Update an incident type -// Update a single incident type from its ID -func (s *Connections) Update(ctx context.Context, request operations.PatchV1IntegrationsConnectionsSlugConnectionIDRequest, opts ...operations.Option) (*operations.PatchV1IntegrationsConnectionsSlugConnectionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IntegrationsConnectionsSlugConnectionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/connections/{slug}/{connection_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IntegrationsConnectionsSlugConnectionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/contributingfactors.go b/internal/sdk/contributingfactors.go deleted file mode 100644 index 3c3b89c..0000000 --- a/internal/sdk/contributingfactors.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type ContributingFactors struct { - sdkConfiguration sdkConfiguration -} - -func newContributingFactors(sdkConfig sdkConfiguration) *ContributingFactors { - return &ContributingFactors{ - sdkConfiguration: sdkConfig, - } -} - -// Create contributing factor -// Add a new contributing factor to an incident -func (s *ContributingFactors) Create(ctx context.Context, request operations.PostV1PostMortemsReportsReportIDReasonsRequest, opts ...operations.Option) (*operations.PostV1PostMortemsReportsReportIDReasonsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1PostMortemsReportsReportIdReasons", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}/reasons", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1PostMortemsReportsReportIDReasons", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1PostMortemsReportsReportIDReasonsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsReasonEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsReasonEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/conversations.go b/internal/sdk/conversations.go deleted file mode 100644 index 7ab71a4..0000000 --- a/internal/sdk/conversations.go +++ /dev/null @@ -1,529 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -// Conversations - Operations about conversations -type Conversations struct { - Comments *Comments - - sdkConfiguration sdkConfiguration -} - -func newConversations(sdkConfig sdkConfiguration) *Conversations { - return &Conversations{ - sdkConfiguration: sdkConfig, - Comments: newComments(sdkConfig), - } -} - -// ArchiveReaction - Archive a reaction -// ALPHA - Archive a reaction -func (s *Conversations) ArchiveReaction(ctx context.Context, request operations.DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDRequest, opts ...operations.Option) (*operations.DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ConversationsConversationIdCommentsCommentIdReactionsReactionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/conversations/{conversation_id}/comments/{comment_id}/reactions/{reaction_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateReaction - Create a reaction -// ALPHA - Create a reaction on a comment -func (s *Conversations) CreateReaction(ctx context.Context, request operations.PostV1ConversationsConversationIDCommentsCommentIDReactionsRequest, opts ...operations.Option) (*operations.PostV1ConversationsConversationIDCommentsCommentIDReactionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ConversationsConversationIdCommentsCommentIdReactions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/conversations/{conversation_id}/comments/{comment_id}/reactions", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1ConversationsConversationIDCommentsCommentIDReactions", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ConversationsConversationIDCommentsCommentIDReactionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListReactions - List all reactions for a comment -// ALPHA - List all of the reactions that have been added to a comment -func (s *Conversations) ListReactions(ctx context.Context, request operations.GetV1ConversationsConversationIDCommentsCommentIDReactionsRequest, opts ...operations.Option) (*operations.GetV1ConversationsConversationIDCommentsCommentIDReactionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ConversationsConversationIdCommentsCommentIdReactions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/conversations/{conversation_id}/comments/{comment_id}/reactions", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ConversationsConversationIDCommentsCommentIDReactionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// PatchComment - Update a comment -// ALPHA - Update a comment's attributes -func (s *Conversations) PatchComment(ctx context.Context, request operations.PatchV1ConversationsConversationIDCommentsCommentIDRequest, opts ...operations.Option) (*operations.PatchV1ConversationsConversationIDCommentsCommentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1ConversationsConversationIdCommentsCommentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/conversations/{conversation_id}/comments/{comment_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1ConversationsConversationIDCommentsCommentID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1ConversationsConversationIDCommentsCommentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetComment - Retrieve a single comment -// ALPHA - Retrieves a single comment by ID -func (s *Conversations) GetComment(ctx context.Context, request operations.GetV1ConversationsConversationIDCommentsCommentIDRequest, opts ...operations.Option) (*operations.GetV1ConversationsConversationIDCommentsCommentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ConversationsConversationIdCommentsCommentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/conversations/{conversation_id}/comments/{comment_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ConversationsConversationIDCommentsCommentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/currentuser.go b/internal/sdk/currentuser.go deleted file mode 100644 index d1dd646..0000000 --- a/internal/sdk/currentuser.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type CurrentUser struct { - sdkConfiguration sdkConfiguration -} - -func newCurrentUser(sdkConfig sdkConfiguration) *CurrentUser { - return &CurrentUser{ - sdkConfiguration: sdkConfig, - } -} - -// Get - Retrieve the current user -func (s *CurrentUser) Get(ctx context.Context, opts ...operations.Option) (*operations.GetV1CurrentUserResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1CurrentUser", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/current_user") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1CurrentUserResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.CurrentUserEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.CurrentUserEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/customfields.go b/internal/sdk/customfields.go deleted file mode 100644 index 2ffe6ae..0000000 --- a/internal/sdk/customfields.go +++ /dev/null @@ -1,632 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type CustomFields struct { - sdkConfiguration sdkConfiguration -} - -func newCustomFields(sdkConfig sdkConfiguration) *CustomFields { - return &CustomFields{ - sdkConfiguration: sdkConfig, - } -} - -// DeleteDefinition - Delete a custom field definition -// Delete a custom field definition -func (s *CustomFields) DeleteDefinition(ctx context.Context, request operations.DeleteV1CustomFieldsDefinitionsFieldIDRequest, opts ...operations.Option) (*operations.DeleteV1CustomFieldsDefinitionsFieldIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1CustomFieldsDefinitionsFieldId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/custom_fields/definitions/{field_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1CustomFieldsDefinitionsFieldIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.OrganizationsCustomFieldDefinitionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.OrganizationsCustomFieldDefinitionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateDefinition - Update custom field definition -// Update a single custom field definition -func (s *CustomFields) UpdateDefinition(ctx context.Context, request operations.PatchV1CustomFieldsDefinitionsFieldIDRequest, opts ...operations.Option) (*operations.PatchV1CustomFieldsDefinitionsFieldIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1CustomFieldsDefinitionsFieldId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/custom_fields/definitions/{field_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1CustomFieldsDefinitionsFieldID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1CustomFieldsDefinitionsFieldIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.OrganizationsCustomFieldDefinitionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.OrganizationsCustomFieldDefinitionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateDefinition - Create custom field definition -// Create a new custom field definition -func (s *CustomFields) CreateDefinition(ctx context.Context, request shared.PostV1CustomFieldsDefinitions, opts ...operations.Option) (*operations.PostV1CustomFieldsDefinitionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1CustomFieldsDefinitions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/custom_fields/definitions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1CustomFieldsDefinitionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.OrganizationsCustomFieldDefinitionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.OrganizationsCustomFieldDefinitionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListDefinitions - List custom field definitions -// List all custom field definitions -func (s *CustomFields) ListDefinitions(ctx context.Context, opts ...operations.Option) (*operations.GetV1CustomFieldsDefinitionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1CustomFieldsDefinitions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/custom_fields/definitions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1CustomFieldsDefinitionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.OrganizationsCustomFieldDefinitionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.OrganizationsCustomFieldDefinitionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetSelectOptions - Get custom field permissible values -// Get the permissible values for the a currently active custom select or multi-select field. -func (s *CustomFields) GetSelectOptions(ctx context.Context, request operations.GetV1CustomFieldsDefinitionsFieldIDSelectOptionsRequest, opts ...operations.Option) (*operations.GetV1CustomFieldsDefinitionsFieldIDSelectOptionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1CustomFieldsDefinitionsFieldIdSelectOptions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/custom_fields/definitions/{field_id}/select_options", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1CustomFieldsDefinitionsFieldIDSelectOptionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.OrganizationsCustomFieldDefinitionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.OrganizationsCustomFieldDefinitionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/entitlements.go b/internal/sdk/entitlements.go deleted file mode 100644 index 8182fb8..0000000 --- a/internal/sdk/entitlements.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Entitlements - Operations about entitlements -type Entitlements struct { - sdkConfiguration sdkConfiguration -} - -func newEntitlements(sdkConfig sdkConfiguration) *Entitlements { - return &Entitlements{ - sdkConfiguration: sdkConfig, - } -} - -// Retrieve all entitlements -func (s *Entitlements) Retrieve(ctx context.Context, request operations.GetV1EntitlementsRequest, opts ...operations.Option) (*operations.GetV1EntitlementsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Entitlements", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/entitlements") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1EntitlementsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EntitlementEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EntitlementEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/environments.go b/internal/sdk/environments.go deleted file mode 100644 index 142ad1c..0000000 --- a/internal/sdk/environments.go +++ /dev/null @@ -1,633 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Environments - Operations about environments -type Environments struct { - sdkConfiguration sdkConfiguration -} - -func newEnvironments(sdkConfig sdkConfiguration) *Environments { - return &Environments{ - sdkConfiguration: sdkConfig, - } -} - -// Create an environment -// Creates an environment for the organization -func (s *Environments) Create(ctx context.Context, request shared.PostV1Environments, opts ...operations.Option) (*operations.PostV1EnvironmentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Environments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/environments") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1EnvironmentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EnvironmentEntryEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EnvironmentEntryEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all environments -// List all of the environments that have been added to the organiation -func (s *Environments) List(ctx context.Context, request operations.GetV1EnvironmentsRequest, opts ...operations.Option) (*operations.GetV1EnvironmentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Environments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/environments") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1EnvironmentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EnvironmentEntryEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EnvironmentEntryEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete - Archive an environment -// Archive an environment -func (s *Environments) Delete(ctx context.Context, request operations.DeleteV1EnvironmentsEnvironmentIDRequest, opts ...operations.Option) (*operations.DeleteV1EnvironmentsEnvironmentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1EnvironmentsEnvironmentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/environments/{environment_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1EnvironmentsEnvironmentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EnvironmentEntryEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EnvironmentEntryEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update an environment -// Update a environments attributes -func (s *Environments) Update(ctx context.Context, request operations.PatchV1EnvironmentsEnvironmentIDRequest, opts ...operations.Option) (*operations.PatchV1EnvironmentsEnvironmentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1EnvironmentsEnvironmentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/environments/{environment_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1EnvironmentsEnvironmentID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1EnvironmentsEnvironmentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EnvironmentEntryEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EnvironmentEntryEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a single environment -// Retrieves a single environment by ID -func (s *Environments) Get(ctx context.Context, request operations.GetV1EnvironmentsEnvironmentIDRequest, opts ...operations.Option) (*operations.GetV1EnvironmentsEnvironmentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1EnvironmentsEnvironmentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/environments/{environment_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1EnvironmentsEnvironmentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EnvironmentEntryEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EnvironmentEntryEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/escalationpolicies.go b/internal/sdk/escalationpolicies.go deleted file mode 100644 index bc41dea..0000000 --- a/internal/sdk/escalationpolicies.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type EscalationPolicies struct { - sdkConfiguration sdkConfiguration -} - -func newEscalationPolicies(sdkConfig sdkConfiguration) *EscalationPolicies { - return &EscalationPolicies{ - sdkConfiguration: sdkConfig, - } -} - -// Update an escalation policy -// Update a Signals escalation policy by ID -func (s *EscalationPolicies) Update(ctx context.Context, request operations.PatchV1TeamsTeamIDEscalationPoliciesIDRequest, opts ...operations.Option) (*operations.PatchV1TeamsTeamIDEscalationPoliciesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TeamsTeamIdEscalationPoliciesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/escalation_policies/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1TeamsTeamIDEscalationPoliciesID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TeamsTeamIDEscalationPoliciesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/events.go b/internal/sdk/events.go deleted file mode 100644 index 8d2dbde..0000000 --- a/internal/sdk/events.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type Events struct { - sdkConfiguration sdkConfiguration -} - -func newEvents(sdkConfig sdkConfiguration) *Events { - return &Events{ - sdkConfiguration: sdkConfig, - } -} - -// GetVoteStatus - Returns the current vote counts for an object -// Returns the current vote counts for an object -func (s *Events) GetVoteStatus(ctx context.Context, request operations.GetV1IncidentsIncidentIDEventsEventIDVotesStatusRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDEventsEventIDVotesStatusResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdEventsEventIdVotesStatus", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/events/{event_id}/votes/status", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDEventsEventIDVotesStatusResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.VotesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.VotesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/executions.go b/internal/sdk/executions.go deleted file mode 100644 index 13f6cdd..0000000 --- a/internal/sdk/executions.go +++ /dev/null @@ -1,372 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type Executions struct { - Steps *Steps - - sdkConfiguration sdkConfiguration -} - -func newExecutions(sdkConfig sdkConfiguration) *Executions { - return &Executions{ - sdkConfiguration: sdkConfig, - Steps: newSteps(sdkConfig), - } -} - -// Delete - Terminate a runbook execution -// Terminates a runbook execution, preventing any further steps from being executed -func (s *Executions) Delete(ctx context.Context, request operations.DeleteV1RunbooksExecutionsExecutionIDRequest, opts ...operations.Option) (*operations.DeleteV1RunbooksExecutionsExecutionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1RunbooksExecutionsExecutionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1RunbooksExecutionsExecutionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateVotes - Update the votes on an object -// Allows for upvoting or downvoting an event -func (s *Executions) UpdateVotes(ctx context.Context, request operations.PatchV1RunbooksExecutionsExecutionIDVotesRequest, opts ...operations.Option) (*operations.PatchV1RunbooksExecutionsExecutionIDVotesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1RunbooksExecutionsExecutionIdVotes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}/votes", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1RunbooksExecutionsExecutionIDVotes", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1RunbooksExecutionsExecutionIDVotesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.VotesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.VotesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetVoteStatus - Returns the current vote counts for an object -// Returns the current vote counts for an object -func (s *Executions) GetVoteStatus(ctx context.Context, request operations.GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusRequest, opts ...operations.Option) (*operations.GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbooksExecutionsExecutionIdStepsStepIdVotesStatus", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}/steps/{step_id}/votes/status", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.VotesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.VotesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/firehydrant.go b/internal/sdk/firehydrant.go deleted file mode 100644 index 5aab14c..0000000 --- a/internal/sdk/firehydrant.go +++ /dev/null @@ -1,351 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/retry" - "net/http" - "time" -) - -// ServerList contains the list of servers available to the SDK -var ServerList = []string{ - "https://api.firehydrant.io", -} - -// HTTPClient provides an interface for suplying the SDK with a custom HTTP client -type HTTPClient interface { - Do(req *http.Request) (*http.Response, error) -} - -// String provides a helper function to return a pointer to a string -func String(s string) *string { return &s } - -// Bool provides a helper function to return a pointer to a bool -func Bool(b bool) *bool { return &b } - -// Int provides a helper function to return a pointer to an int -func Int(i int) *int { return &i } - -// Int64 provides a helper function to return a pointer to an int64 -func Int64(i int64) *int64 { return &i } - -// Float32 provides a helper function to return a pointer to a float32 -func Float32(f float32) *float32 { return &f } - -// Float64 provides a helper function to return a pointer to a float64 -func Float64(f float64) *float64 { return &f } - -// Pointer provides a helper function to return a pointer to a type -func Pointer[T any](v T) *T { return &v } - -type sdkConfiguration struct { - Client HTTPClient - Security func(context.Context) (interface{}, error) - ServerURL string - ServerIndex int - Language string - OpenAPIDocVersion string - SDKVersion string - GenVersion string - UserAgent string - RetryConfig *retry.Config - Hooks *hooks.Hooks - Timeout *time.Duration -} - -func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { - if c.ServerURL != "" { - return c.ServerURL, nil - } - - return ServerList[c.ServerIndex], nil -} - -type Firehydrant struct { - // Operations about pings - Ping *Ping - // Operations about environments - Environments *Environments - // Operations about services - Services *Services - ServiceDependencies *ServiceDependencies - // Operations about functionalities - Functionalities *Functionalities - // Operations about teams - Teams *Teams - // Operations about changes - Changes *Changes - // Operations about change_types - ChangeTypes *ChangeTypes - // Operations about entitlements - Entitlements *Entitlements - // Operations about incidents - Incidents *Incidents - IncidentRoles *IncidentRoles - IncidentTags *IncidentTags - IncidentTypes *IncidentTypes - // Operations about integrations - Integrations *Integrations - // Operations about users - Users *Users - CurrentUser *CurrentUser - // Operations about reports - Reports *Reports - // Operations about metrics - Metrics *Metrics - // Operations about runbooks - Runbooks *Runbooks - RunbookAudits *RunbookAudits - // Operations about nunc_connections - NuncConnections *NuncConnections - SavedSearches *SavedSearches - // Operations about lifecycles - Lifecycles *Lifecycles - // Operations about priorities - Priorities *Priorities - // Operations about severities - Severities *Severities - SeverityMatrix *SeverityMatrix - // Operations about scheduled_maintenances - ScheduledMaintenances *ScheduledMaintenances - // Operations about schedules - Schedules *Schedules - // Operations about infrastructures - Infrastructures *Infrastructures - // Operations about nuncs - Nunc *Nunc - // Operations about status_update_templates - StatusUpdateTemplates *StatusUpdateTemplates - CustomFields *CustomFields - PostMortems *PostMortems - // Operations about alerts - Alerts *Alerts - // Operations about processing_log_entries - ProcessingLogEntries *ProcessingLogEntries - // Operations about ticketings - Ticketing *Ticketing - // Operations about task_lists - TaskLists *TaskLists - // Operations about noauths - Noauth *Noauth - // Operations about scims - Scim *Scim - // Operations about catalogs - Catalogs *Catalogs - ChecklistTemplates *ChecklistTemplates - // Operations about bootstraps - Bootstrap *Bootstrap - FormConfigurations *FormConfigurations - // Operations about conversations - Conversations *Conversations - // Operations about signals - Signals *Signals - // Operations about signals_on_calls - SignalsOnCall *SignalsOnCall - // Operations about webhooks - Webhooks *Webhooks - // Operations about ais - Ai *Ai - - sdkConfiguration sdkConfiguration -} - -type SDKOption func(*Firehydrant) - -// WithServerURL allows the overriding of the default server URL -func WithServerURL(serverURL string) SDKOption { - return func(sdk *Firehydrant) { - sdk.sdkConfiguration.ServerURL = serverURL - } -} - -// WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters -func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption { - return func(sdk *Firehydrant) { - if params != nil { - serverURL = utils.ReplaceParameters(serverURL, params) - } - - sdk.sdkConfiguration.ServerURL = serverURL - } -} - -// WithServerIndex allows the overriding of the default server by index -func WithServerIndex(serverIndex int) SDKOption { - return func(sdk *Firehydrant) { - if serverIndex < 0 || serverIndex >= len(ServerList) { - panic(fmt.Errorf("server index %d out of range", serverIndex)) - } - - sdk.sdkConfiguration.ServerIndex = serverIndex - } -} - -// WithClient allows the overriding of the default HTTP client used by the SDK -func WithClient(client HTTPClient) SDKOption { - return func(sdk *Firehydrant) { - sdk.sdkConfiguration.Client = client - } -} - -// WithSecurity configures the SDK to use the provided security details -func WithSecurity(security shared.Security) SDKOption { - return func(sdk *Firehydrant) { - sdk.sdkConfiguration.Security = utils.AsSecuritySource(security) - } -} - -// WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication -func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption { - return func(sdk *Firehydrant) { - sdk.sdkConfiguration.Security = func(ctx context.Context) (interface{}, error) { - return security(ctx) - } - } -} - -func WithRetryConfig(retryConfig retry.Config) SDKOption { - return func(sdk *Firehydrant) { - sdk.sdkConfiguration.RetryConfig = &retryConfig - } -} - -// WithTimeout Optional request timeout applied to each operation -func WithTimeout(timeout time.Duration) SDKOption { - return func(sdk *Firehydrant) { - sdk.sdkConfiguration.Timeout = &timeout - } -} - -// New creates a new instance of the SDK with the provided options -func New(opts ...SDKOption) *Firehydrant { - sdk := &Firehydrant{ - sdkConfiguration: sdkConfiguration{ - Language: "go", - OpenAPIDocVersion: "0.0.1", - SDKVersion: "0.0.1", - GenVersion: "2.438.3", - UserAgent: "speakeasy-sdk/go 0.0.1 2.438.3 0.0.1 github.com/firehydrant/terraform-provider-firehydrant/internal/sdk", - Hooks: hooks.New(), - }, - } - for _, opt := range opts { - opt(sdk) - } - - // Use WithClient to override the default client if you would like to customize the timeout - if sdk.sdkConfiguration.Client == nil { - sdk.sdkConfiguration.Client = &http.Client{Timeout: 60 * time.Second} - } - - currentServerURL, _ := sdk.sdkConfiguration.GetServerDetails() - serverURL := currentServerURL - serverURL, sdk.sdkConfiguration.Client = sdk.sdkConfiguration.Hooks.SDKInit(currentServerURL, sdk.sdkConfiguration.Client) - if serverURL != currentServerURL { - sdk.sdkConfiguration.ServerURL = serverURL - } - - sdk.Ping = newPing(sdk.sdkConfiguration) - - sdk.Environments = newEnvironments(sdk.sdkConfiguration) - - sdk.Services = newServices(sdk.sdkConfiguration) - - sdk.ServiceDependencies = newServiceDependencies(sdk.sdkConfiguration) - - sdk.Functionalities = newFunctionalities(sdk.sdkConfiguration) - - sdk.Teams = newTeams(sdk.sdkConfiguration) - - sdk.Changes = newChanges(sdk.sdkConfiguration) - - sdk.ChangeTypes = newChangeTypes(sdk.sdkConfiguration) - - sdk.Entitlements = newEntitlements(sdk.sdkConfiguration) - - sdk.Incidents = newIncidents(sdk.sdkConfiguration) - - sdk.IncidentRoles = newIncidentRoles(sdk.sdkConfiguration) - - sdk.IncidentTags = newIncidentTags(sdk.sdkConfiguration) - - sdk.IncidentTypes = newIncidentTypes(sdk.sdkConfiguration) - - sdk.Integrations = newIntegrations(sdk.sdkConfiguration) - - sdk.Users = newUsers(sdk.sdkConfiguration) - - sdk.CurrentUser = newCurrentUser(sdk.sdkConfiguration) - - sdk.Reports = newReports(sdk.sdkConfiguration) - - sdk.Metrics = newMetrics(sdk.sdkConfiguration) - - sdk.Runbooks = newRunbooks(sdk.sdkConfiguration) - - sdk.RunbookAudits = newRunbookAudits(sdk.sdkConfiguration) - - sdk.NuncConnections = newNuncConnections(sdk.sdkConfiguration) - - sdk.SavedSearches = newSavedSearches(sdk.sdkConfiguration) - - sdk.Lifecycles = newLifecycles(sdk.sdkConfiguration) - - sdk.Priorities = newPriorities(sdk.sdkConfiguration) - - sdk.Severities = newSeverities(sdk.sdkConfiguration) - - sdk.SeverityMatrix = newSeverityMatrix(sdk.sdkConfiguration) - - sdk.ScheduledMaintenances = newScheduledMaintenances(sdk.sdkConfiguration) - - sdk.Schedules = newSchedules(sdk.sdkConfiguration) - - sdk.Infrastructures = newInfrastructures(sdk.sdkConfiguration) - - sdk.Nunc = newNunc(sdk.sdkConfiguration) - - sdk.StatusUpdateTemplates = newStatusUpdateTemplates(sdk.sdkConfiguration) - - sdk.CustomFields = newCustomFields(sdk.sdkConfiguration) - - sdk.PostMortems = newPostMortems(sdk.sdkConfiguration) - - sdk.Alerts = newAlerts(sdk.sdkConfiguration) - - sdk.ProcessingLogEntries = newProcessingLogEntries(sdk.sdkConfiguration) - - sdk.Ticketing = newTicketing(sdk.sdkConfiguration) - - sdk.TaskLists = newTaskLists(sdk.sdkConfiguration) - - sdk.Noauth = newNoauth(sdk.sdkConfiguration) - - sdk.Scim = newScim(sdk.sdkConfiguration) - - sdk.Catalogs = newCatalogs(sdk.sdkConfiguration) - - sdk.ChecklistTemplates = newChecklistTemplates(sdk.sdkConfiguration) - - sdk.Bootstrap = newBootstrap(sdk.sdkConfiguration) - - sdk.FormConfigurations = newFormConfigurations(sdk.sdkConfiguration) - - sdk.Conversations = newConversations(sdk.sdkConfiguration) - - sdk.Signals = newSignals(sdk.sdkConfiguration) - - sdk.SignalsOnCall = newSignalsOnCall(sdk.sdkConfiguration) - - sdk.Webhooks = newWebhooks(sdk.sdkConfiguration) - - sdk.Ai = newAi(sdk.sdkConfiguration) - - return sdk -} diff --git a/internal/sdk/firehydrantpriorities.go b/internal/sdk/firehydrantpriorities.go deleted file mode 100644 index f6e19e3..0000000 --- a/internal/sdk/firehydrantpriorities.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type FirehydrantPriorities struct { - sdkConfiguration sdkConfiguration -} - -func newFirehydrantPriorities(sdkConfig sdkConfiguration) *FirehydrantPriorities { - return &FirehydrantPriorities{ - sdkConfiguration: sdkConfig, - } -} - -// Update a ticketing priority -// Update a single ticketing priority's attributes -func (s *FirehydrantPriorities) Update(ctx context.Context, request operations.PatchV1TicketingPrioritiesIDRequest, opts ...operations.Option) (*operations.PatchV1TicketingPrioritiesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TicketingPrioritiesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/priorities/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1TicketingPrioritiesID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TicketingPrioritiesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingPriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingPriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/firehydrantreports.go b/internal/sdk/firehydrantreports.go deleted file mode 100644 index c5c59c1..0000000 --- a/internal/sdk/firehydrantreports.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type FirehydrantReports struct { - sdkConfiguration sdkConfiguration -} - -func newFirehydrantReports(sdkConfig sdkConfiguration) *FirehydrantReports { - return &FirehydrantReports{ - sdkConfiguration: sdkConfig, - } -} - -// Patch - Update a report -// Update a report -func (s *FirehydrantReports) Patch(ctx context.Context, request operations.PatchV1PostMortemsReportsReportIDRequest, opts ...operations.Option) (*operations.PatchV1PostMortemsReportsReportIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1PostMortemsReportsReportId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1PostMortemsReportsReportID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1PostMortemsReportsReportIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsPostMortemReportEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsPostMortemReportEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/firehydrantusers.go b/internal/sdk/firehydrantusers.go deleted file mode 100644 index 7529a9e..0000000 --- a/internal/sdk/firehydrantusers.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type FirehydrantUsers struct { - sdkConfiguration sdkConfiguration -} - -func newFirehydrantUsers(sdkConfig sdkConfiguration) *FirehydrantUsers { - return &FirehydrantUsers{ - sdkConfiguration: sdkConfig, - } -} - -// Delete - Deletes a User using SCIM protocol -// SCIM endpoint to delete a User. This endpoint will deactivate a confirmed User record in our system. -func (s *FirehydrantUsers) Delete(ctx context.Context, request operations.DeleteV1ScimV2UsersIDRequest, opts ...operations.Option) (*operations.DeleteV1ScimV2UsersIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ScimV2UsersId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scim/v2/Users/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ScimV2UsersIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/formconfigurations.go b/internal/sdk/formconfigurations.go deleted file mode 100644 index fb26c42..0000000 --- a/internal/sdk/formconfigurations.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type FormConfigurations struct { - sdkConfiguration sdkConfiguration -} - -func newFormConfigurations(sdkConfig sdkConfiguration) *FormConfigurations { - return &FormConfigurations{ - sdkConfiguration: sdkConfig, - } -} - -// Get - Retrieve a single checklist template -// Retrieves a single checklist template by ID -func (s *FormConfigurations) Get(ctx context.Context, request operations.GetV1FormConfigurationsSlugRequest, opts ...operations.Option) (*operations.GetV1FormConfigurationsSlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1FormConfigurationsSlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/form_configurations/{slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1FormConfigurationsSlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/functionalities.go b/internal/sdk/functionalities.go deleted file mode 100644 index 08c269e..0000000 --- a/internal/sdk/functionalities.go +++ /dev/null @@ -1,729 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Functionalities - Operations about functionalities -type Functionalities struct { - sdkConfiguration sdkConfiguration -} - -func newFunctionalities(sdkConfig sdkConfiguration) *Functionalities { - return &Functionalities{ - sdkConfiguration: sdkConfig, - } -} - -// Create a functionality -// Creates a functionality for the organization -func (s *Functionalities) Create(ctx context.Context, request shared.PostV1Functionalities, opts ...operations.Option) (*operations.PostV1FunctionalitiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Functionalities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/functionalities") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1FunctionalitiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.FunctionalityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.FunctionalityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all functionalities -// List all of the functionalities that have been added to the organiation -func (s *Functionalities) List(ctx context.Context, request operations.GetV1FunctionalitiesRequest, opts ...operations.Option) (*operations.GetV1FunctionalitiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Functionalities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/functionalities") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1FunctionalitiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.FunctionalityEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.FunctionalityEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Archive a functionality -// Archive a functionality -func (s *Functionalities) Archive(ctx context.Context, request operations.DeleteV1FunctionalitiesFunctionalityIDRequest, opts ...operations.Option) (*operations.DeleteV1FunctionalitiesFunctionalityIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1FunctionalitiesFunctionalityId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/functionalities/{functionality_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1FunctionalitiesFunctionalityIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.FunctionalityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.FunctionalityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a functionality -// Update a functionalities attributes -func (s *Functionalities) Update(ctx context.Context, request operations.PatchV1FunctionalitiesFunctionalityIDRequest, opts ...operations.Option) (*operations.PatchV1FunctionalitiesFunctionalityIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1FunctionalitiesFunctionalityId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/functionalities/{functionality_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1FunctionalitiesFunctionalityID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1FunctionalitiesFunctionalityIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.FunctionalityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.FunctionalityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a single functionality -// Retrieves a single functionality by ID -func (s *Functionalities) Get(ctx context.Context, request operations.GetV1FunctionalitiesFunctionalityIDRequest, opts ...operations.Option) (*operations.GetV1FunctionalitiesFunctionalityIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1FunctionalitiesFunctionalityId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/functionalities/{functionality_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1FunctionalitiesFunctionalityIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.FunctionalityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.FunctionalityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Functionalities) ListServices(ctx context.Context, request operations.GetV1FunctionalitiesFunctionalityIDServicesRequest, opts ...operations.Option) (*operations.GetV1FunctionalitiesFunctionalityIDServicesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1FunctionalitiesFunctionalityIdServices", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/functionalities/{functionality_id}/services", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1FunctionalitiesFunctionalityIDServicesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/impact.go b/internal/sdk/impact.go deleted file mode 100644 index 00758a6..0000000 --- a/internal/sdk/impact.go +++ /dev/null @@ -1,170 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type Impact struct { - sdkConfiguration sdkConfiguration -} - -func newImpact(sdkConfig sdkConfiguration) *Impact { - return &Impact{ - sdkConfiguration: sdkConfig, - } -} - -// Add impacted infrastructure -// Add impacted infrastructure to an incident -func (s *Impact) Add(ctx context.Context, request operations.PostV1IncidentsIncidentIDImpactTypeRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDImpactTypeResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdImpactType", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/impact/{type}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDImpactType", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDImpactTypeResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentImpactEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentImpactEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/incidentroles.go b/internal/sdk/incidentroles.go deleted file mode 100644 index 0a7fff2..0000000 --- a/internal/sdk/incidentroles.go +++ /dev/null @@ -1,632 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type IncidentRoles struct { - sdkConfiguration sdkConfiguration -} - -func newIncidentRoles(sdkConfig sdkConfiguration) *IncidentRoles { - return &IncidentRoles{ - sdkConfiguration: sdkConfig, - } -} - -// List all incident roles -// List all of the incident roles in the organization -func (s *IncidentRoles) List(ctx context.Context, request operations.GetV1IncidentRolesRequest, opts ...operations.Option) (*operations.GetV1IncidentRolesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentRoles", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/incident_roles") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentRolesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentRoleEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentRoleEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Create an incident role -// Create a new incident role -func (s *IncidentRoles) Create(ctx context.Context, request shared.PostV1IncidentRoles, opts ...operations.Option) (*operations.PostV1IncidentRolesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentRoles", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/incident_roles") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentRolesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentRoleEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentRoleEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update an incident role -// Update a single incident role from its ID -func (s *IncidentRoles) Update(ctx context.Context, request operations.PatchV1IncidentRolesIncidentRoleIDRequest, opts ...operations.Option) (*operations.PatchV1IncidentRolesIncidentRoleIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentRolesIncidentRoleId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incident_roles/{incident_role_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentRolesIncidentRoleID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentRolesIncidentRoleIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentRoleEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentRoleEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve an incident role -// Retrieve a single incident role from its ID -func (s *IncidentRoles) Get(ctx context.Context, request operations.GetV1IncidentRolesIncidentRoleIDRequest, opts ...operations.Option) (*operations.GetV1IncidentRolesIncidentRoleIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentRolesIncidentRoleId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incident_roles/{incident_role_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentRolesIncidentRoleIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentRoleEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentRoleEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Archive an incident role -// Archives an incident role which will hide it from lists and metrics -func (s *IncidentRoles) Archive(ctx context.Context, request operations.DeleteV1IncidentRolesIncidentRoleIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentRolesIncidentRoleIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentRolesIncidentRoleId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incident_roles/{incident_role_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentRolesIncidentRoleIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentRoleEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentRoleEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/incidents.go b/internal/sdk/incidents.go deleted file mode 100644 index 85e4819..0000000 --- a/internal/sdk/incidents.go +++ /dev/null @@ -1,6546 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Incidents - Operations about incidents -type Incidents struct { - Links *Links - Events *Events - Impact *Impact - Notes *Notes - RoleAssignments *RoleAssignments - - sdkConfiguration sdkConfiguration -} - -func newIncidents(sdkConfig sdkConfiguration) *Incidents { - return &Incidents{ - sdkConfiguration: sdkConfig, - Links: newLinks(sdkConfig), - Events: newEvents(sdkConfig), - Impact: newImpact(sdkConfig), - Notes: newNotes(sdkConfig), - RoleAssignments: newRoleAssignments(sdkConfig), - } -} - -// Create an incident -// Create a new incident -func (s *Incidents) Create(ctx context.Context, request shared.PostV1Incidents, opts ...operations.Option) (*operations.PostV1IncidentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Incidents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/incidents") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all incidents -// List all of the incidents in the organization -func (s *Incidents) List(ctx context.Context, request operations.GetV1IncidentsRequest, opts ...operations.Option) (*operations.GetV1IncidentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Incidents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/incidents") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetChannel - Retrieve chat channel information for an incident -// Gives chat channel information for the specified incident -func (s *Incidents) GetChannel(ctx context.Context, request operations.GetV1IncidentsIncidentIDChannelRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDChannelResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdChannel", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/channel", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDChannelResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsChannelEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsChannelEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Close an incident -// Closes an incident and optionally close all children -func (s *Incidents) Close(ctx context.Context, request operations.PutV1IncidentsIncidentIDCloseRequest, opts ...operations.Option) (*operations.PutV1IncidentsIncidentIDCloseResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1IncidentsIncidentIdClose", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/close", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1IncidentsIncidentIDCloseResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Resolve an active incident -// Resolves a currently active incident -func (s *Incidents) Resolve(ctx context.Context, request operations.PutV1IncidentsIncidentIDResolveRequest, opts ...operations.Option) (*operations.PutV1IncidentsIncidentIDResolveResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1IncidentsIncidentIdResolve", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/resolve", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1IncidentsIncidentIDResolveResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Archive an incident -// Archives an incident which will hide it from lists and metrics -func (s *Incidents) Archive(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update an incident -// Updates an incident with provided parameters -func (s *Incidents) Update(ctx context.Context, request operations.PatchV1IncidentsIncidentIDRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentsIncidentID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve an incident -// Retrieve a single incident from its ID -func (s *Incidents) Get(ctx context.Context, request operations.GetV1IncidentsIncidentIDRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Unarchive - Unarchives an incident -// Unarchives an incident -func (s *Incidents) Unarchive(ctx context.Context, request operations.PostV1IncidentsIncidentIDUnarchiveRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDUnarchiveResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdUnarchive", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/unarchive", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDUnarchiveResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AttachAlert - Attach an alert to an incident -// Add an alert to an incident. FireHydrant needs to have ingested the alert from a third party system in order to attach it to the incident. -func (s *Incidents) AttachAlert(ctx context.Context, request operations.PostV1IncidentsIncidentIDAlertsRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDAlertsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdAlerts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/alerts", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDAlertsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListAlerts - List alerts on an incident -// List alerts that have been attached to an incident -func (s *Incidents) ListAlerts(ctx context.Context, request operations.GetV1IncidentsIncidentIDAlertsRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDAlertsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdAlerts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/alerts", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDAlertsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsAlertEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsAlertEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// SetPrimaryAlert - Set an alert as primary -// Setting an alert as primary will overwrite milestone times in the FireHydrant incident with times included in the primary alert. Services attached to the primary alert will also be automatically added to the incident. -func (s *Incidents) SetPrimaryAlert(ctx context.Context, request operations.PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentIdAlertsIncidentAlertIdPrimary", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/alerts/{incident_alert_id}/primary", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsAlertEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsAlertEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteAlert - Remove an alert -// Remove an alert from an incident -func (s *Incidents) DeleteAlert(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdAlertsIncidentAlertId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/alerts/{incident_alert_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateMilestonesBulk - Update milestone times -// Update milestone times in bulk for a given incident. All milestone -// times for an incident must occur in chronological order -// corresponding to the configured order of milestones. If the result -// of this request would cause any milestone(s) to appear out of place, -// a 422 response will instead be returned. This includes milestones -// not explicitly submitted or updated in this request. -func (s *Incidents) UpdateMilestonesBulk(ctx context.Context, request operations.PutV1IncidentsIncidentIDMilestonesBulkUpdateRequest, opts ...operations.Option) (*operations.PutV1IncidentsIncidentIDMilestonesBulkUpdateResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1IncidentsIncidentIdMilestonesBulkUpdate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/milestones/bulk_update", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PutV1IncidentsIncidentIDMilestonesBulkUpdate", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1IncidentsIncidentIDMilestonesBulkUpdateResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsMilestoneEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsMilestoneEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListMilestones - List milestones on an incident -// List times and durations for each milestone on an incident -func (s *Incidents) ListMilestones(ctx context.Context, request operations.GetV1IncidentsIncidentIDMilestonesRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDMilestonesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdMilestones", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/milestones", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDMilestonesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsMilestoneEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsMilestoneEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddRelatedChange - Add a related change to an incident -// Add a related change to an incident. Changes added to an incident can be causes, fixes, or suspects. To remove a change from an incident, the type field should be set to dismissed. -func (s *Incidents) AddRelatedChange(ctx context.Context, request operations.PostV1IncidentsIncidentIDRelatedChangeEventsRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDRelatedChangeEventsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdRelatedChangeEvents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/related_change_events", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDRelatedChangeEvents", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDRelatedChangeEventsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsRelatedChangeEventEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsRelatedChangeEventEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode == 409: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListRelatedChangeEvents - List related changes on an incident -// List related changes that have been attached to an incident -func (s *Incidents) ListRelatedChangeEvents(ctx context.Context, request operations.GetV1IncidentsIncidentIDRelatedChangeEventsRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDRelatedChangeEventsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdRelatedChangeEvents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/related_change_events", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDRelatedChangeEventsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsRelatedChangeEventEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsRelatedChangeEventEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateRelatedChangeEvent - Update a change attached to an incident -// Update a change attached to an incident -func (s *Incidents) UpdateRelatedChangeEvent(ctx context.Context, request operations.PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentIdRelatedChangeEventsRelatedChangeEventId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/related_change_events/{related_change_event_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsRelatedChangeEventEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsRelatedChangeEventEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode == 409: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddStatusPage - Add a status page to an incident -// Add a status page to an incident. -func (s *Incidents) AddStatusPage(ctx context.Context, request operations.PostV1IncidentsIncidentIDStatusPagesRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDStatusPagesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdStatusPages", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/status_pages", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDStatusPages", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDStatusPagesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsStatusPageEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsStatusPageEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListStatusPages - List status pages on an incident -// List status pages that are attached to an incident -func (s *Incidents) ListStatusPages(ctx context.Context, request operations.GetV1IncidentsIncidentIDStatusPagesRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDStatusPagesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdStatusPages", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/status_pages", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDStatusPagesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsStatusPageEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsStatusPageEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// RemoveStatusPageIncident - Remove a status page incident attached to an incident -// Remove a status page incident attached to an incident -func (s *Incidents) RemoveStatusPageIncident(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdStatusPagesStatusPageId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/status_pages/{status_page_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddTaskList - Adds tasks to incident from task list -// Add all tasks from list to incident -func (s *Incidents) AddTaskList(ctx context.Context, request operations.PostV1IncidentsIncidentIDTaskListsRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDTaskListsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdTaskLists", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/task_lists", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDTaskLists", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDTaskListsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateTask - Creates a new task -// Create a task -func (s *Incidents) CreateTask(ctx context.Context, request operations.PostV1IncidentsIncidentIDTasksRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDTasksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdTasks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/tasks", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDTasks", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDTasksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListTasks - Retrieve tasks -// Retrieve a list of all tasks for a specific incident -func (s *Incidents) ListTasks(ctx context.Context, request operations.GetV1IncidentsIncidentIDTasksRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDTasksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdTasks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/tasks", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDTasksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteTask - Deletes a task -// Delete a task -func (s *Incidents) DeleteTask(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDTasksTaskIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDTasksTaskIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdTasksTaskId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/tasks/{task_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDTasksTaskIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateTask - Update a task -// Update a task's attributes -func (s *Incidents) UpdateTask(ctx context.Context, request operations.PatchV1IncidentsIncidentIDTasksTaskIDRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDTasksTaskIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentIdTasksTaskId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/tasks/{task_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentsIncidentIDTasksTaskID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDTasksTaskIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetTask - Retrieve a single task for an incident -// Retrieve a single task for an incident -func (s *Incidents) GetTask(ctx context.Context, request operations.GetV1IncidentsIncidentIDTasksTaskIDRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDTasksTaskIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdTasksTaskId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/tasks/{task_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDTasksTaskIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ConvertTask - Creates a follow-up from a task, removing the task in the process -// Convert a task to a follow-up -func (s *Incidents) ConvertTask(ctx context.Context, request operations.PostV1IncidentsIncidentIDTasksTaskIDConvertRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDTasksTaskIDConvertResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdTasksTaskIdConvert", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/tasks/{task_id}/convert", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDTasksTaskIDConvert", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDTasksTaskIDConvertResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListLinks - List all the editable links on an incident -// List all the editable, external incident links attached to an incident -func (s *Incidents) ListLinks(ctx context.Context, request operations.GetV1IncidentsIncidentIDLinksRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDLinksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdLinks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/links", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDLinksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.AttachmentsLinkEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.AttachmentsLinkEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddLink - Add a link to the incident -// Allows adding adhoc links to an incident as an attachment -func (s *Incidents) AddLink(ctx context.Context, request operations.PostV1IncidentsIncidentIDLinksRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDLinksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdLinks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/links", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDLinks", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDLinksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.AttachmentsLinkEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.AttachmentsLinkEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteLink - Deletes the external incident link -// Deletes the external incident link -func (s *Incidents) DeleteLink(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDLinksLinkIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDLinksLinkIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdLinksLinkId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/links/{link_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDLinksLinkIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetTranscript - Lists all of the messages in the incident's transcript -// Retrieve the transcript for a specific incident -func (s *Incidents) GetTranscript(ctx context.Context, request operations.GetV1IncidentsIncidentIDTranscriptRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDTranscriptResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdTranscript", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/transcript", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDTranscriptResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PublicAPIV1IncidentsTranscriptEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PublicAPIV1IncidentsTranscriptEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Incidents) DeleteTranscript(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDTranscriptTranscriptIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDTranscriptTranscriptIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdTranscriptTranscriptId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/transcript/{transcript_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDTranscriptTranscriptIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Incidents) GetSimilar(ctx context.Context, request operations.GetV1IncidentsIncidentIDSimilarRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDSimilarResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdSimilar", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/similar", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDSimilarResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Incidents) GetAttachments(ctx context.Context, request operations.GetV1IncidentsIncidentIDAttachmentsRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDAttachmentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdAttachments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/attachments", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDAttachmentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddAttachment - Add an attachment to the incident timeline -// Allows adding image attachments to an incident -func (s *Incidents) AddAttachment(ctx context.Context, request operations.PostV1IncidentsIncidentIDAttachmentsRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDAttachmentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdAttachments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/attachments", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "multipart", `request:"mediaType=multipart/form-data"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDAttachmentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentAttachmentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentAttachmentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListEvents - List events for an incident -// List all events for an incident. An event is a timeline entry. This can be filtered with params to retrieve events of a certain type. -func (s *Incidents) ListEvents(ctx context.Context, request operations.GetV1IncidentsIncidentIDEventsRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDEventsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdEvents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/events", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDEventsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEventEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEventEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteEvent - Delete a single event for an incident -// Delete a single event for an incident -func (s *Incidents) DeleteEvent(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDEventsEventIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDEventsEventIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdEventsEventId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/events/{event_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDEventsEventIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEventEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEventEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateEvent - Update a single event for an incident -// Update a single event for an incident -func (s *Incidents) UpdateEvent(ctx context.Context, request operations.PatchV1IncidentsIncidentIDEventsEventIDRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDEventsEventIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentIdEventsEventId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/events/{event_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDEventsEventIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEventEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEventEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetEvent - Retrieve a single event for an incident -// Retrieve a single event for an incident -func (s *Incidents) GetEvent(ctx context.Context, request operations.GetV1IncidentsIncidentIDEventsEventIDRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDEventsEventIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdEventsEventId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/events/{event_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDEventsEventIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEventEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEventEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateVotes - Update the votes on an object -// Allows for upvoting or downvoting an event -func (s *Incidents) UpdateVotes(ctx context.Context, request operations.PatchV1IncidentsIncidentIDEventsEventIDVotesRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDEventsEventIDVotesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentIdEventsEventIdVotes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/events/{event_id}/votes", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentsIncidentIDEventsEventIDVotes", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDEventsEventIDVotesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.VotesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.VotesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateImpact - Create a status update for an incident -// Allows updating an incident's impacted infrastructure, with the option to -// move the incident into a different milestone and provide a note to update -// the incident timeline and any attached status pages. If this method is -// requested with the PUT verb, impacts will be completely replaced with the -// information in the request body, even if not provided (effectively clearing -// all impacts). If this method is requested with the PATCH verb, the provided -// impacts will be added or updated, but no impacts will be removed. -func (s *Incidents) UpdateImpact(ctx context.Context, request operations.PatchV1IncidentsIncidentIDImpactRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDImpactResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentIdImpact", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/impact", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentsIncidentIDImpact", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDImpactResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateImpactStatus - Create a status update for an incident -// Allows updating an incident's impacted infrastructure, with the option to -// move the incident into a different milestone and provide a note to update -// the incident timeline and any attached status pages. If this method is -// requested with the PUT verb, impacts will be completely replaced with the -// information in the request body, even if not provided (effectively clearing -// all impacts). If this method is requested with the PATCH verb, the provided -// impacts will be added or updated, but no impacts will be removed. -func (s *Incidents) UpdateImpactStatus(ctx context.Context, request operations.PutV1IncidentsIncidentIDImpactRequest, opts ...operations.Option) (*operations.PutV1IncidentsIncidentIDImpactResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1IncidentsIncidentIdImpact", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/impact", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PutV1IncidentsIncidentIDImpact", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1IncidentsIncidentIDImpactResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetImpactByType - List impacted infrastructure -// List impacted infrastructure on an incident by specifying type -func (s *Incidents) GetImpactByType(ctx context.Context, request operations.GetV1IncidentsIncidentIDImpactTypeRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDImpactTypeResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdImpactType", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/impact/{type}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDImpactTypeResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentImpactEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentImpactEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// RemoveImpact - Remove impacted infrastructure on an incident -// Remove impacted infrastructure on an incident -func (s *Incidents) RemoveImpact(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDImpactTypeIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDImpactTypeIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdImpactTypeId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/impact/{type}/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDImpactTypeIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddNote - Add a note to an incident -// Create a new note on for an incident. The visibility field on a note determines where it gets posted. -func (s *Incidents) AddNote(ctx context.Context, request operations.PostV1IncidentsIncidentIDNotesRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDNotesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdNotes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/notes", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDNotes", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDNotesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EventNoteEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EventNoteEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddGenericChatMessage - Add a generic chat message to the incident timeline. -// Create a new generic chat message on an incident timeline. These are independent of any specific chat provider. -func (s *Incidents) AddGenericChatMessage(ctx context.Context, request operations.PostV1IncidentsIncidentIDGenericChatMessagesRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDGenericChatMessagesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdGenericChatMessages", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/generic_chat_messages", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDGenericChatMessages", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDGenericChatMessagesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EventGenericChatMessageEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EventGenericChatMessageEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteGenericChatMessage - Delete an existing generic chat message on an incident. -// Delete an existing generic chat message on an incident. -func (s *Incidents) DeleteGenericChatMessage(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdGenericChatMessagesMessageId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/generic_chat_messages/{message_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EventGenericChatMessageEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EventGenericChatMessageEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateGenericChatMessage - Update an existing generic chat message on an incident. -// Update an existing generic chat message on an incident. -func (s *Incidents) UpdateGenericChatMessage(ctx context.Context, request operations.PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentIdGenericChatMessagesMessageId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/generic_chat_messages/{message_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentsIncidentIDGenericChatMessagesMessageID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EventGenericChatMessageEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EventGenericChatMessageEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListRoleAssignments - List all assignees -// Retrieve a list of all of the current role assignments for the incident -func (s *Incidents) ListRoleAssignments(ctx context.Context, request operations.GetV1IncidentsIncidentIDRoleAssignmentsRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDRoleAssignmentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdRoleAssignments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/role_assignments", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDRoleAssignmentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsRoleAssignmentEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsRoleAssignmentEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AssignRole - Assign a role -// Assign a role to a user for this incident -func (s *Incidents) AssignRole(ctx context.Context, request operations.PostV1IncidentsIncidentIDRoleAssignmentsRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDRoleAssignmentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdRoleAssignments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/role_assignments", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDRoleAssignments", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDRoleAssignmentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsRoleAssignmentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsRoleAssignmentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AssignTeam - Assign a team -// Assign a team for this incident -func (s *Incidents) AssignTeam(ctx context.Context, request operations.PostV1IncidentsIncidentIDTeamAssignmentsRequest, opts ...operations.Option) (*operations.PostV1IncidentsIncidentIDTeamAssignmentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentsIncidentIdTeamAssignments", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/team_assignments", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1IncidentsIncidentIDTeamAssignments", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentsIncidentIDTeamAssignmentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteTeamAssignment - Unassign a team -// Unassign a team from an incident -func (s *Incidents) DeleteTeamAssignment(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdTeamAssignmentsTeamAssignmentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/team_assignments/{team_assignment_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetUserRole - Get current role for user -// Retrieve a user with current roles for an incident -func (s *Incidents) GetUserRole(ctx context.Context, request operations.GetV1IncidentsIncidentIDUsersUserIDRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDUsersUserIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdUsersUserId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/users/{user_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDUsersUserIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsRoleAssignmentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsRoleAssignmentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListRelationships - List any parent/child relationships for an incident -// List any parent/child relationships for an incident -func (s *Incidents) ListRelationships(ctx context.Context, request operations.GetV1IncidentsIncidentIDRelationshipsRequest, opts ...operations.Option) (*operations.GetV1IncidentsIncidentIDRelationshipsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentsIncidentIdRelationships", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/relationships", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentsIncidentIDRelationshipsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsRelationshipsEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsRelationshipsEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/incidenttags.go b/internal/sdk/incidenttags.go deleted file mode 100644 index b295d27..0000000 --- a/internal/sdk/incidenttags.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type IncidentTags struct { - sdkConfiguration sdkConfiguration -} - -func newIncidentTags(sdkConfig sdkConfiguration) *IncidentTags { - return &IncidentTags{ - sdkConfiguration: sdkConfig, - } -} - -// Validate a list of tags -// Validate the format of a list of tags -func (s *IncidentTags) Validate(ctx context.Context, request []string, opts ...operations.Option) (*operations.PostV1IncidentTagsValidateResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentTagsValidate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/incident_tags/validate") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentTagsValidateResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TagEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TagEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all incident tags -// List all of the incident tags in the organization -func (s *IncidentTags) List(ctx context.Context, request operations.GetV1IncidentTagsRequest, opts ...operations.Option) (*operations.GetV1IncidentTagsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentTags", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/incident_tags") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentTagsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TagEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TagEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/incidenttypes.go b/internal/sdk/incidenttypes.go deleted file mode 100644 index 013a6ac..0000000 --- a/internal/sdk/incidenttypes.go +++ /dev/null @@ -1,632 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type IncidentTypes struct { - sdkConfiguration sdkConfiguration -} - -func newIncidentTypes(sdkConfig sdkConfiguration) *IncidentTypes { - return &IncidentTypes{ - sdkConfiguration: sdkConfig, - } -} - -// Create an incident type -// Create a new incident type -func (s *IncidentTypes) Create(ctx context.Context, request shared.PostV1IncidentTypes, opts ...operations.Option) (*operations.PostV1IncidentTypesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IncidentTypes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/incident_types") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IncidentTypesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentTypeEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentTypeEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete - Archive an incident type -// Archives an incident type which will hide it from lists and metrics -func (s *IncidentTypes) Delete(ctx context.Context, request operations.DeleteV1IncidentTypesIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentTypesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentTypesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incident_types/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentTypesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentTypeEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentTypeEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all incident types -// List all of the incident types in the organization -func (s *IncidentTypes) List(ctx context.Context, request operations.GetV1IncidentTypesRequest, opts ...operations.Option) (*operations.GetV1IncidentTypesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentTypes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/incident_types") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentTypesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentTypeEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentTypeEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update an incident type -// Update a single incident type from its ID -func (s *IncidentTypes) Update(ctx context.Context, request operations.PatchV1IncidentTypesIDRequest, opts ...operations.Option) (*operations.PatchV1IncidentTypesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentTypesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incident_types/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentTypesID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentTypesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentTypeEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentTypeEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve an incident type -// Retrieve a single incident type from its ID -func (s *IncidentTypes) Get(ctx context.Context, request operations.GetV1IncidentTypesIDRequest, opts ...operations.Option) (*operations.GetV1IncidentTypesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IncidentTypesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incident_types/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IncidentTypesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentTypeEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentTypeEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/infrastructures.go b/internal/sdk/infrastructures.go deleted file mode 100644 index df62eea..0000000 --- a/internal/sdk/infrastructures.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Infrastructures - Operations about infrastructures -type Infrastructures struct { - sdkConfiguration sdkConfiguration -} - -func newInfrastructures(sdkConfig sdkConfiguration) *Infrastructures { - return &Infrastructures{ - sdkConfiguration: sdkConfig, - } -} - -// List - Lists functionality, service and environment objects -// Lists functionality, service and environment objects -func (s *Infrastructures) List(ctx context.Context, request operations.GetV1InfrastructuresRequest, opts ...operations.Option) (*operations.GetV1InfrastructuresResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Infrastructures", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/infrastructures") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1InfrastructuresResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.InfrastructureSearchEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.InfrastructureSearchEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/integrations.go b/internal/sdk/integrations.go deleted file mode 100644 index 4c1e4e1..0000000 --- a/internal/sdk/integrations.go +++ /dev/null @@ -1,2857 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Integrations - Operations about integrations -type Integrations struct { - Connections *Connections - Statuses *Statuses - AwsConnections *AwsConnections - - sdkConfiguration sdkConfiguration -} - -func newIntegrations(sdkConfig sdkConfiguration) *Integrations { - return &Integrations{ - sdkConfiguration: sdkConfig, - Connections: newConnections(sdkConfig), - Statuses: newStatuses(sdkConfig), - AwsConnections: newAwsConnections(sdkConfig), - } -} - -// List all incident types -// List all of the incident types in the organization -func (s *Integrations) List(ctx context.Context, opts ...operations.Option) (*operations.GetV1IntegrationsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Integrations", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/integrations") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a single integration -func (s *Integrations) Get(ctx context.Context, request operations.GetV1IntegrationsIntegrationIDRequest, opts ...operations.Option) (*operations.GetV1IntegrationsIntegrationIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsIntegrationId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/{integration_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsIntegrationIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsIntegrationEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsIntegrationEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateFieldMap - Update field map -// Update field map -func (s *Integrations) UpdateFieldMap(ctx context.Context, request operations.PatchV1IntegrationsFieldMapsFieldMapIDRequest, opts ...operations.Option) (*operations.PatchV1IntegrationsFieldMapsFieldMapIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IntegrationsFieldMapsFieldMapId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/field_maps/{field_map_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IntegrationsFieldMapsFieldMapIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.FieldMappingFieldMapEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.FieldMappingFieldMapEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetAvailableFields - Get mappable fields -// Get a description of the fields to which data can be mapped -func (s *Integrations) GetAvailableFields(ctx context.Context, request operations.GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsRequest, opts ...operations.Option) (*operations.GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsFieldMapsFieldMapIdAvailableFields", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/field_maps/{field_map_id}/available_fields", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.FieldMappingMappableFieldEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.FieldMappingMappableFieldEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Integrations) ListConnections(ctx context.Context, request operations.GetV1IntegrationsConnectionsRequest, opts ...operations.Option) (*operations.GetV1IntegrationsConnectionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsConnections", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/integrations/connections") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsConnectionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Integrations) CreateConnection(ctx context.Context, request operations.PostV1IntegrationsConnectionsSlugRequest, opts ...operations.Option) (*operations.PostV1IntegrationsConnectionsSlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IntegrationsConnectionsSlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/connections/{slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IntegrationsConnectionsSlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Integrations) RefreshConnection(ctx context.Context, request operations.PatchV1IntegrationsConnectionsSlugConnectionIDRefreshRequest, opts ...operations.Option) (*operations.PatchV1IntegrationsConnectionsSlugConnectionIDRefreshResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IntegrationsConnectionsSlugConnectionIdRefresh", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/connections/{slug}/{connection_id}/refresh", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IntegrationsConnectionsSlugConnectionIDRefreshResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetAwsConnections - List AWS connections -// Lists the available and configured AWS integration connections for the authenticated organization. -func (s *Integrations) GetAwsConnections(ctx context.Context, request operations.GetV1IntegrationsAwsConnectionsRequest, opts ...operations.Option) (*operations.GetV1IntegrationsAwsConnectionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsAwsConnections", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/integrations/aws/connections") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsAwsConnectionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsAwsConnectionEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsAwsConnectionEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListCloudTrailBatches - List CloudTrail batches -// Lists CloudTrail batches for the authenticated organization. -func (s *Integrations) ListCloudTrailBatches(ctx context.Context, request operations.GetV1IntegrationsAwsCloudtrailBatchesRequest, opts ...operations.Option) (*operations.GetV1IntegrationsAwsCloudtrailBatchesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsAwsCloudtrailBatches", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/integrations/aws/cloudtrail_batches") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsAwsCloudtrailBatchesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsAwsCloudtrailBatchEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsAwsCloudtrailBatchEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateCloudtrailBatch - Update a CloudTrail batch -// Update a CloudTrail batch with new information. -func (s *Integrations) UpdateCloudtrailBatch(ctx context.Context, request operations.PatchV1IntegrationsAwsCloudtrailBatchesIDRequest, opts ...operations.Option) (*operations.PatchV1IntegrationsAwsCloudtrailBatchesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IntegrationsAwsCloudtrailBatchesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/aws/cloudtrail_batches/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IntegrationsAwsCloudtrailBatchesID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IntegrationsAwsCloudtrailBatchesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsAwsCloudtrailBatchEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsAwsCloudtrailBatchEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetCloudtrailBatch - Retrieve a CloudTrail batch -// Retrieve a single CloudTrail batch. -func (s *Integrations) GetCloudtrailBatch(ctx context.Context, request operations.GetV1IntegrationsAwsCloudtrailBatchesIDRequest, opts ...operations.Option) (*operations.GetV1IntegrationsAwsCloudtrailBatchesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsAwsCloudtrailBatchesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/aws/cloudtrail_batches/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsAwsCloudtrailBatchesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsAwsCloudtrailBatchEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsAwsCloudtrailBatchEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Integrations) GetAwsCloudtrailBatchEvents(ctx context.Context, request operations.GetV1IntegrationsAwsCloudtrailBatchesIDEventsRequest, opts ...operations.Option) (*operations.GetV1IntegrationsAwsCloudtrailBatchesIDEventsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsAwsCloudtrailBatchesIdEvents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/aws/cloudtrail_batches/{id}/events", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsAwsCloudtrailBatchesIDEventsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListSpaceKeys - Lists available space keys -// Lists available space keys for the Confluence integration connection. -func (s *Integrations) ListSpaceKeys(ctx context.Context, request operations.GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchRequest, opts ...operations.Option) (*operations.GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsConfluenceCloudConnectionsIdSpaceSearch", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/confluence_cloud/connections/{id}/space/search", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsConfluenceCloudSpaceKeyEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsConfluenceCloudSpaceKeyEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Integrations) GetSlackWorkspaces(ctx context.Context, request operations.GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesRequest, opts ...operations.Option) (*operations.GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsSlackConnectionsConnectionIdWorkspaces", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/slack/connections/{connection_id}/workspaces", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Integrations) GetSlackUserGroups(ctx context.Context, opts ...operations.Option) (*operations.GetV1IntegrationsSlackUsergroupsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsSlackUsergroups", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/integrations/slack/usergroups") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsSlackUsergroupsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateSlackEmojiAction - Creates a new slack emoji action -// Creates a new slack emoji action -func (s *Integrations) CreateSlackEmojiAction(ctx context.Context, request operations.PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest, opts ...operations.Option) (*operations.PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1IntegrationsSlackConnectionsConnectionIdEmojiActions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/slack/connections/{connection_id}/emoji_actions", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListSlackEmojiActions - Lists all slack emoji actions -// Lists all slack emoji actions -func (s *Integrations) ListSlackEmojiActions(ctx context.Context, request operations.GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest, opts ...operations.Option) (*operations.GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsSlackConnectionsConnectionIdEmojiActions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/slack/connections/{connection_id}/emoji_actions", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteSlackEmojiAction - Deletes a slack emoji action -// Deletes a slack emoji action -func (s *Integrations) DeleteSlackEmojiAction(ctx context.Context, request operations.DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest, opts ...operations.Option) (*operations.DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IntegrationsSlackConnectionsConnectionIdEmojiActionsEmojiActionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/slack/connections/{connection_id}/emoji_actions/{emoji_action_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateSlackEmojiAction - Updates a slack emoji action -// Updates a slack emoji action -func (s *Integrations) UpdateSlackEmojiAction(ctx context.Context, request operations.PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest, opts ...operations.Option) (*operations.PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IntegrationsSlackConnectionsConnectionIdEmojiActionsEmojiActionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/slack/connections/{connection_id}/emoji_actions/{emoji_action_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetSlackEmojiAction - Retrieves a slack emoji action -// Retrieves a slack emoji action -func (s *Integrations) GetSlackEmojiAction(ctx context.Context, request operations.GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest, opts ...operations.Option) (*operations.GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsSlackConnectionsConnectionIdEmojiActionsEmojiActionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/slack/connections/{connection_id}/emoji_actions/{emoji_action_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListStatuspageConnections - List Statuspage connections -// Lists the available and configured Statuspage integrations connections for the authenticated organization. -func (s *Integrations) ListStatuspageConnections(ctx context.Context, request operations.GetV1IntegrationsStatuspageConnectionsRequest, opts ...operations.Option) (*operations.GetV1IntegrationsStatuspageConnectionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsStatuspageConnections", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/integrations/statuspage/connections") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsStatuspageConnectionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsStatuspageConnectionEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsStatuspageConnectionEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteStatuspageConnection - Delete a Statuspage connection -// Deletes the given Statuspage integration connection. -func (s *Integrations) DeleteStatuspageConnection(ctx context.Context, request operations.DeleteV1IntegrationsStatuspageConnectionsConnectionIDRequest, opts ...operations.Option) (*operations.DeleteV1IntegrationsStatuspageConnectionsConnectionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IntegrationsStatuspageConnectionsConnectionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/statuspage/connections/{connection_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IntegrationsStatuspageConnectionsConnectionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsStatuspageConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsStatuspageConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateStatuspageConnection - Update a Statuspage connection -// Update the given Statuspage integration connection. -func (s *Integrations) UpdateStatuspageConnection(ctx context.Context, request operations.PatchV1IntegrationsStatuspageConnectionsConnectionIDRequest, opts ...operations.Option) (*operations.PatchV1IntegrationsStatuspageConnectionsConnectionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IntegrationsStatuspageConnectionsConnectionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/statuspage/connections/{connection_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IntegrationsStatuspageConnectionsConnectionID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IntegrationsStatuspageConnectionsConnectionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsStatuspageConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsStatuspageConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetStatuspageConnection - Retrieve a Statuspage connection -// Retrieve the information about the Statuspage connection. -func (s *Integrations) GetStatuspageConnection(ctx context.Context, request operations.GetV1IntegrationsStatuspageConnectionsConnectionIDRequest, opts ...operations.Option) (*operations.GetV1IntegrationsStatuspageConnectionsConnectionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsStatuspageConnectionsConnectionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/statuspage/connections/{connection_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsStatuspageConnectionsConnectionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IntegrationsStatuspageConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IntegrationsStatuspageConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Integrations) GetStatuspageConnectionsPages(ctx context.Context, request operations.GetV1IntegrationsStatuspageConnectionsConnectionIDPagesRequest, opts ...operations.Option) (*operations.GetV1IntegrationsStatuspageConnectionsConnectionIDPagesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsStatuspageConnectionsConnectionIdPages", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/statuspage/connections/{connection_id}/pages", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsStatuspageConnectionsConnectionIDPagesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Integrations) GetZendeskSearch(ctx context.Context, request operations.GetV1IntegrationsZendeskSearchRequest, opts ...operations.Option) (*operations.GetV1IntegrationsZendeskSearchResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsZendeskSearch", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/integrations/zendesk/search") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsZendeskSearchResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/internal/hooks/hooks.go b/internal/sdk/internal/hooks/hooks.go deleted file mode 100644 index 8ea491a..0000000 --- a/internal/sdk/internal/hooks/hooks.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package hooks - -import ( - "context" - "errors" - "net/http" -) - -type FailEarly struct { - Cause error -} - -var _ error = (*FailEarly)(nil) - -func (f *FailEarly) Error() string { - return f.Cause.Error() -} - -// HTTPClient provides an interface for supplying the SDK with a custom HTTP client -type HTTPClient interface { - Do(req *http.Request) (*http.Response, error) -} - -type HookContext struct { - Context context.Context - OperationID string - OAuth2Scopes []string - SecuritySource func(context.Context) (interface{}, error) -} - -type BeforeRequestContext struct { - HookContext -} - -type AfterSuccessContext struct { - HookContext -} - -type AfterErrorContext struct { - HookContext -} - -// sdkInitHook is called when the SDK is initializing. The hook can modify and return a new baseURL and HTTP client to be used by the SDK. -type sdkInitHook interface { - SDKInit(baseURL string, client HTTPClient) (string, HTTPClient) -} - -// beforeRequestHook is called before the SDK sends a request. The hook can modify the request before it is sent or return an error to stop the request from being sent. -type beforeRequestHook interface { - BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error) -} - -// afterSuccessHook is called after the SDK receives a response. The hook can modify the response before it is handled or return an error to stop the response from being handled. -type afterSuccessHook interface { - AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error) -} - -// afterErrorHook is called after the SDK encounters an error, or a non-successful response. The hook can modify the response if available otherwise modify the error. -// All afterErrorHook hooks are called and returning an error won't stop the other hooks from being called. But if you want to stop the other hooks from being called, you can return a FailEarly error wrapping your error. -type afterErrorHook interface { - AfterError(hookCtx AfterErrorContext, res *http.Response, err error) (*http.Response, error) -} - -type Hooks struct { - sdkInitHooks []sdkInitHook - beforeRequestHook []beforeRequestHook - afterSuccessHook []afterSuccessHook - afterErrorHook []afterErrorHook -} - -func New() *Hooks { - h := &Hooks{ - sdkInitHooks: []sdkInitHook{}, - beforeRequestHook: []beforeRequestHook{}, - afterSuccessHook: []afterSuccessHook{}, - afterErrorHook: []afterErrorHook{}, - } - - initHooks(h) - - return h -} - -// registerSDKInitHook registers a hook to be used by the SDK for the initialization event. -func (h *Hooks) registerSDKInitHook(hook sdkInitHook) { - h.sdkInitHooks = append(h.sdkInitHooks, hook) -} - -// registerBeforeRequestHook registers a hook to be used by the SDK for the before request event. -func (h *Hooks) registerBeforeRequestHook(hook beforeRequestHook) { - h.beforeRequestHook = append(h.beforeRequestHook, hook) -} - -// registerAfterSuccessHook registers a hook to be used by the SDK for the after success event. -func (h *Hooks) registerAfterSuccessHook(hook afterSuccessHook) { - h.afterSuccessHook = append(h.afterSuccessHook, hook) -} - -// registerAfterErrorHook registers a hook to be used by the SDK for the after error event. -func (h *Hooks) registerAfterErrorHook(hook afterErrorHook) { - h.afterErrorHook = append(h.afterErrorHook, hook) -} - -func (h *Hooks) SDKInit(baseURL string, client HTTPClient) (string, HTTPClient) { - for _, hook := range h.sdkInitHooks { - baseURL, client = hook.SDKInit(baseURL, client) - } - return baseURL, client -} - -func (h *Hooks) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error) { - for _, hook := range h.beforeRequestHook { - var err error - req, err = hook.BeforeRequest(hookCtx, req) - if err != nil { - return req, err - } - } - return req, nil -} - -func (h *Hooks) AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error) { - for _, hook := range h.afterSuccessHook { - var err error - res, err = hook.AfterSuccess(hookCtx, res) - if err != nil { - return res, err - } - } - return res, nil -} - -func (h *Hooks) AfterError(hookCtx AfterErrorContext, res *http.Response, err error) (*http.Response, error) { - for _, hook := range h.afterErrorHook { - res, err = hook.AfterError(hookCtx, res, err) - var fe *FailEarly - if errors.As(err, &fe) { - return nil, fe.Cause - } - } - return res, err -} diff --git a/internal/sdk/internal/hooks/registration.go b/internal/sdk/internal/hooks/registration.go deleted file mode 100644 index fa131be..0000000 --- a/internal/sdk/internal/hooks/registration.go +++ /dev/null @@ -1,18 +0,0 @@ -package hooks - -/* - * This file is only ever generated once on the first generation and then is free to be modified. - * Any hooks you wish to add should be registered in the initHooks function. Feel free to define - * your hooks in this file or in separate files in the hooks package. - * - * Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance. - */ - -func initHooks(h *Hooks) { - // exampleHook := &ExampleHook{} - - // h.registerSDKInitHook(exampleHook) - // h.registerBeforeRequestHook(exampleHook) - // h.registerAfterErrorHook(exampleHook) - // h.registerAfterSuccessHook(exampleHook) -} diff --git a/internal/sdk/internal/utils/contenttype.go b/internal/sdk/internal/utils/contenttype.go deleted file mode 100644 index f6487e0..0000000 --- a/internal/sdk/internal/utils/contenttype.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "fmt" - "mime" - "strings" -) - -func MatchContentType(contentType string, pattern string) bool { - if contentType == "" { - contentType = "application/octet-stream" - } - - if contentType == pattern || pattern == "*" || pattern == "*/*" { - return true - } - - mediaType, _, err := mime.ParseMediaType(contentType) - if err != nil { - return false - } - - if mediaType == pattern { - return true - } - - parts := strings.Split(mediaType, "/") - if len(parts) == 2 { - if fmt.Sprintf("%s/*", parts[0]) == pattern || fmt.Sprintf("*/%s", parts[1]) == pattern { - return true - } - } - - return false -} diff --git a/internal/sdk/internal/utils/form.go b/internal/sdk/internal/utils/form.go deleted file mode 100644 index 10056a5..0000000 --- a/internal/sdk/internal/utils/form.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "fmt" - "math/big" - "net/url" - "reflect" - "strings" - "time" - - "github.com/ericlagergren/decimal" - - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" -) - -func populateForm(paramName string, explode bool, objType reflect.Type, objValue reflect.Value, delimiter string, getFieldName func(reflect.StructField) string) url.Values { - - formValues := url.Values{} - - if isNil(objType, objValue) { - return formValues - } - - if objType.Kind() == reflect.Pointer { - objType = objType.Elem() - objValue = objValue.Elem() - } - - switch objType.Kind() { - case reflect.Struct: - switch objValue.Interface().(type) { - case time.Time: - formValues.Add(paramName, valToString(objValue.Interface())) - case types.Date: - formValues.Add(paramName, valToString(objValue.Interface())) - case big.Int: - formValues.Add(paramName, valToString(objValue.Interface())) - case decimal.Big: - formValues.Add(paramName, valToString(objValue.Interface())) - default: - var items []string - - for i := 0; i < objType.NumField(); i++ { - fieldType := objType.Field(i) - valType := objValue.Field(i) - - if isNil(fieldType.Type, valType) { - continue - } - - if valType.Kind() == reflect.Pointer { - valType = valType.Elem() - } - - fieldName := getFieldName(fieldType) - if fieldName == "" { - continue - } - - if explode { - formValues.Add(fieldName, valToString(valType.Interface())) - } else { - items = append(items, fmt.Sprintf("%s%s%s", fieldName, delimiter, valToString(valType.Interface()))) - } - } - - if len(items) > 0 { - formValues.Add(paramName, strings.Join(items, delimiter)) - } - } - case reflect.Map: - items := []string{} - - iter := objValue.MapRange() - for iter.Next() { - if explode { - formValues.Add(iter.Key().String(), valToString(iter.Value().Interface())) - } else { - items = append(items, fmt.Sprintf("%s%s%s", iter.Key().String(), delimiter, valToString(iter.Value().Interface()))) - } - } - - if len(items) > 0 { - formValues.Add(paramName, strings.Join(items, delimiter)) - } - case reflect.Slice, reflect.Array: - values := parseDelimitedArray(explode, objValue, delimiter) - for _, v := range values { - formValues.Add(paramName, v) - } - default: - formValues.Add(paramName, valToString(objValue.Interface())) - } - - return formValues -} - -func parseDelimitedArray(explode bool, objValue reflect.Value, delimiter string) []string { - values := []string{} - items := []string{} - - for i := 0; i < objValue.Len(); i++ { - if explode { - values = append(values, valToString(objValue.Index(i).Interface())) - } else { - items = append(items, valToString(objValue.Index(i).Interface())) - } - } - - if len(items) > 0 { - values = append(values, strings.Join(items, delimiter)) - } - - return values -} diff --git a/internal/sdk/internal/utils/headers.go b/internal/sdk/internal/utils/headers.go deleted file mode 100644 index a07608b..0000000 --- a/internal/sdk/internal/utils/headers.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "context" - "fmt" - "net/http" - "reflect" - "strings" -) - -func PopulateHeaders(_ context.Context, req *http.Request, headers interface{}, globals interface{}) { - globalsAlreadyPopulated := populateHeaders(headers, globals, req.Header, []string{}) - if globals != nil { - _ = populateHeaders(globals, nil, req.Header, globalsAlreadyPopulated) - } -} - -func populateHeaders(headers interface{}, globals interface{}, reqHeaders http.Header, skipFields []string) []string { - headerParamsStructType, headerParamsValType := dereferencePointers(reflect.TypeOf(headers), reflect.ValueOf(headers)) - - globalsAlreadyPopulated := []string{} - - for i := 0; i < headerParamsStructType.NumField(); i++ { - fieldType := headerParamsStructType.Field(i) - valType := headerParamsValType.Field(i) - - if contains(skipFields, fieldType.Name) { - continue - } - - if globals != nil { - var globalFound bool - fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, headerParamTagKey, globals) - if globalFound { - globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) - } - } - - tag := parseParamTag(headerParamTagKey, fieldType, "simple", false) - if tag == nil { - continue - } - - value := serializeHeader(fieldType.Type, valType, tag.Explode) - if value != "" { - reqHeaders.Add(tag.ParamName, value) - } - } - - return globalsAlreadyPopulated -} - -func serializeHeader(objType reflect.Type, objValue reflect.Value, explode bool) string { - if isNil(objType, objValue) { - return "" - } - - if objType.Kind() == reflect.Pointer { - objType = objType.Elem() - objValue = objValue.Elem() - } - - switch objType.Kind() { - case reflect.Struct: - items := []string{} - - for i := 0; i < objType.NumField(); i++ { - fieldType := objType.Field(i) - valType := objValue.Field(i) - - if isNil(fieldType.Type, valType) { - continue - } - - if fieldType.Type.Kind() == reflect.Pointer { - valType = valType.Elem() - } - - tag := parseParamTag(headerParamTagKey, fieldType, "simple", false) - if tag == nil { - continue - } - - fieldName := tag.ParamName - - if fieldName == "" { - continue - } - - if explode { - items = append(items, fmt.Sprintf("%s=%s", fieldName, valToString(valType.Interface()))) - } else { - items = append(items, fieldName, valToString(valType.Interface())) - } - } - - return strings.Join(items, ",") - case reflect.Map: - items := []string{} - - iter := objValue.MapRange() - for iter.Next() { - if explode { - items = append(items, fmt.Sprintf("%s=%s", iter.Key().String(), valToString(iter.Value().Interface()))) - } else { - items = append(items, iter.Key().String(), valToString(iter.Value().Interface())) - } - } - - return strings.Join(items, ",") - case reflect.Slice, reflect.Array: - items := []string{} - - for i := 0; i < objValue.Len(); i++ { - items = append(items, valToString(objValue.Index(i).Interface())) - } - - return strings.Join(items, ",") - default: - return valToString(objValue.Interface()) - } -} diff --git a/internal/sdk/internal/utils/json.go b/internal/sdk/internal/utils/json.go deleted file mode 100644 index 0e3b080..0000000 --- a/internal/sdk/internal/utils/json.go +++ /dev/null @@ -1,675 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "bytes" - "encoding/json" - "fmt" - "math/big" - "reflect" - "strconv" - "strings" - "time" - "unsafe" - - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - - "github.com/ericlagergren/decimal" -) - -func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, error) { - typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) - - switch { - case isModelType(typ): - if topLevel { - return json.Marshal(v) - } - - if isNil(typ, val) { - return []byte("null"), nil - } - - out := map[string]json.RawMessage{} - - for i := 0; i < typ.NumField(); i++ { - field := typ.Field(i) - fieldVal := val.Field(i) - - fieldName := field.Name - - omitEmpty := false - jsonTag := field.Tag.Get("json") - if jsonTag != "" { - for _, tag := range strings.Split(jsonTag, ",") { - if tag == "omitempty" { - omitEmpty = true - } else { - fieldName = tag - } - } - } - - if isNil(field.Type, fieldVal) && field.Tag.Get("const") == "" { - if omitEmpty { - continue - } - } - - if !field.IsExported() && field.Tag.Get("const") == "" { - continue - } - - additionalProperties := field.Tag.Get("additionalProperties") - if fieldName == "-" && additionalProperties == "" { - continue - } - - if additionalProperties == "true" { - if isNil(field.Type, fieldVal) { - continue - } - fieldVal := trueReflectValue(fieldVal) - if fieldVal.Type().Kind() != reflect.Map { - return nil, fmt.Errorf("additionalProperties must be a map") - } - - for _, key := range fieldVal.MapKeys() { - r, err := marshalValue(fieldVal.MapIndex(key).Interface(), field.Tag) - if err != nil { - return nil, err - } - - out[key.String()] = r - } - - continue - } - - var fv interface{} - - if field.IsExported() { - fv = fieldVal.Interface() - } else { - pt := reflect.New(typ).Elem() - pt.Set(val) - - pf := pt.Field(i) - - fv = reflect.NewAt(pf.Type(), unsafe.Pointer(pf.UnsafeAddr())).Elem().Interface() - } - - r, err := marshalValue(fv, field.Tag) - if err != nil { - return nil, err - } - - out[fieldName] = r - } - - return json.Marshal(out) - default: - return marshalValue(v, tag) - } -} - -func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, disallowUnknownFields bool) error { - if reflect.TypeOf(v).Kind() != reflect.Ptr { - return fmt.Errorf("v must be a pointer") - } - - typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) - - switch { - case isModelType(typ): - if topLevel || bytes.Equal(b, []byte("null")) { - d := json.NewDecoder(bytes.NewReader(b)) - if disallowUnknownFields { - d.DisallowUnknownFields() - } - return d.Decode(v) - } - - var unmarhsaled map[string]json.RawMessage - - if err := json.Unmarshal(b, &unmarhsaled); err != nil { - return err - } - - var additionalPropertiesField *reflect.StructField - var additionalPropertiesValue *reflect.Value - - for i := 0; i < typ.NumField(); i++ { - field := typ.Field(i) - fieldVal := val.Field(i) - - fieldName := field.Name - - jsonTag := field.Tag.Get("json") - if jsonTag != "" { - for _, tag := range strings.Split(jsonTag, ",") { - if tag != "omitempty" { - fieldName = tag - } - } - } - - if field.Tag.Get("additionalProperties") == "true" { - additionalPropertiesField = &field - additionalPropertiesValue = &fieldVal - continue - } - - // If we receive a value for a const field ignore it but mark it as unmarshaled - if field.Tag.Get("const") != "" { - if r, ok := unmarhsaled[fieldName]; ok { - val := string(r) - - if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { - var err error - val, err = strconv.Unquote(val) - if err != nil { - return fmt.Errorf("failed to unquote const field `%s` value `%s`: %w", fieldName, val, err) - } - } - constValue := field.Tag.Get("const") - if val != constValue { - return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val) - } - - delete(unmarhsaled, fieldName) - } - } else if !field.IsExported() { - continue - } - - value, ok := unmarhsaled[fieldName] - if !ok { - defaultTag := field.Tag.Get("default") - if defaultTag != "" { - value = handleDefaultConstValue(defaultTag, fieldVal.Interface(), field.Tag) - ok = true - } - } else { - delete(unmarhsaled, fieldName) - } - - if ok { - if err := unmarshalValue(value, fieldVal, field.Tag, disallowUnknownFields); err != nil { - return err - } - } - } - - keys := make([]string, 0, len(unmarhsaled)) - for k := range unmarhsaled { - keys = append(keys, k) - } - - if len(keys) > 0 { - if disallowUnknownFields && (additionalPropertiesField == nil || additionalPropertiesValue == nil) { - return fmt.Errorf("unknown fields: %v", keys) - } - - if additionalPropertiesField != nil && additionalPropertiesValue != nil { - typeOfMap := additionalPropertiesField.Type - if additionalPropertiesValue.Type().Kind() == reflect.Interface { - typeOfMap = reflect.TypeOf(map[string]interface{}{}) - } else if additionalPropertiesValue.Type().Kind() != reflect.Map { - return fmt.Errorf("additionalProperties must be a map") - } - - mapValue := reflect.MakeMap(typeOfMap) - - for key, value := range unmarhsaled { - val := reflect.New(typeOfMap.Elem()) - - if err := unmarshalValue(value, val, additionalPropertiesField.Tag, disallowUnknownFields); err != nil { - return err - } - - if val.Elem().Type().String() == typeOfMap.Elem().String() { - mapValue.SetMapIndex(reflect.ValueOf(key), val.Elem()) - } else { - mapValue.SetMapIndex(reflect.ValueOf(key), trueReflectValue(val)) - } - - } - if additionalPropertiesValue.Type().Kind() == reflect.Interface { - additionalPropertiesValue.Set(mapValue) - } else { - additionalPropertiesValue.Set(mapValue) - } - } - } - default: - return unmarshalValue(b, reflect.ValueOf(v), tag, disallowUnknownFields) - } - - return nil -} - -func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) { - constTag := tag.Get("const") - if constTag != "" { - return handleDefaultConstValue(constTag, v, tag), nil - } - - if isNil(reflect.TypeOf(v), reflect.ValueOf(v)) { - defaultTag := tag.Get("default") - if defaultTag != "" { - return handleDefaultConstValue(defaultTag, v, tag), nil - } - - return []byte("null"), nil - } - - typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) - switch typ.Kind() { - case reflect.Int64: - format := tag.Get("integer") - if format == "string" { - b := val.Interface().(int64) - return []byte(fmt.Sprintf(`"%d"`, b)), nil - } - case reflect.Float64: - format := tag.Get("number") - if format == "string" { - b := val.Interface().(float64) - return []byte(fmt.Sprintf(`"%g"`, b)), nil - } - case reflect.Map: - if isNil(typ, val) { - return []byte("null"), nil - } - - out := map[string]json.RawMessage{} - - for _, key := range val.MapKeys() { - itemVal := val.MapIndex(key) - - if isNil(itemVal.Type(), itemVal) { - out[key.String()] = []byte("null") - continue - } - - r, err := marshalValue(itemVal.Interface(), tag) - if err != nil { - return nil, err - } - - out[key.String()] = r - } - - return json.Marshal(out) - case reflect.Slice, reflect.Array: - if isNil(typ, val) { - return []byte("null"), nil - } - - out := []json.RawMessage{} - - for i := 0; i < val.Len(); i++ { - itemVal := val.Index(i) - - if isNil(itemVal.Type(), itemVal) { - out = append(out, []byte("null")) - continue - } - - r, err := marshalValue(itemVal.Interface(), tag) - if err != nil { - return nil, err - } - - out = append(out, r) - } - - return json.Marshal(out) - case reflect.Struct: - switch typ { - case reflect.TypeOf(time.Time{}): - return []byte(fmt.Sprintf(`"%s"`, val.Interface().(time.Time).Format(time.RFC3339Nano))), nil - case reflect.TypeOf(big.Int{}): - format := tag.Get("bigint") - if format == "string" { - b := val.Interface().(big.Int) - return []byte(fmt.Sprintf(`"%s"`, (&b).String())), nil - } - case reflect.TypeOf(decimal.Big{}): - format := tag.Get("decimal") - if format == "number" { - b := val.Interface().(decimal.Big) - f, ok := (&b).Float64() - if ok { - return []byte(b.String()), nil - } - - return []byte(fmt.Sprintf(`%f`, f)), nil - } - } - } - - return json.Marshal(v) -} - -func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.StructTag) json.RawMessage { - if tagValue == "null" { - return []byte("null") - } - - typ := dereferenceTypePointer(reflect.TypeOf(val)) - switch typ { - case reflect.TypeOf(time.Time{}): - return []byte(fmt.Sprintf(`"%s"`, tagValue)) - case reflect.TypeOf(big.Int{}): - bigIntTag := tag.Get("bigint") - if bigIntTag == "string" { - return []byte(fmt.Sprintf(`"%s"`, tagValue)) - } - case reflect.TypeOf(int64(0)): - format := tag.Get("integer") - if format == "string" { - return []byte(fmt.Sprintf(`"%s"`, tagValue)) - } - case reflect.TypeOf(float64(0)): - format := tag.Get("number") - if format == "string" { - return []byte(fmt.Sprintf(`"%s"`, tagValue)) - } - case reflect.TypeOf(decimal.Big{}): - decimalTag := tag.Get("decimal") - if decimalTag != "number" { - return []byte(fmt.Sprintf(`"%s"`, tagValue)) - } - case reflect.TypeOf(types.Date{}): - return []byte(fmt.Sprintf(`"%s"`, tagValue)) - default: - if typ.Kind() == reflect.String { - return []byte(fmt.Sprintf("%q", tagValue)) - } - } - - return []byte(tagValue) -} - -func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag, disallowUnknownFields bool) error { - if bytes.Equal(value, []byte("null")) { - if v.CanAddr() { - return json.Unmarshal(value, v.Addr().Interface()) - } else { - return json.Unmarshal(value, v.Interface()) - } - } - - typ := dereferenceTypePointer(v.Type()) - - switch typ.Kind() { - case reflect.Int64: - var b int64 - - format := tag.Get("integer") - if format == "string" { - var s string - if err := json.Unmarshal(value, &s); err != nil { - return err - } - - var err error - b, err = strconv.ParseInt(s, 10, 64) - if err != nil { - return fmt.Errorf("failed to parse string as int64: %w", err) - } - if v.Kind() == reflect.Ptr { - if v.IsNil() { - v.Set(reflect.New(typ)) - } - v = v.Elem() - } - - v.Set(reflect.ValueOf(b)) - return nil - } - case reflect.Float64: - var b float64 - - format := tag.Get("number") - if format == "string" { - var s string - if err := json.Unmarshal(value, &s); err != nil { - return err - } - - var err error - b, err = strconv.ParseFloat(s, 64) - if err != nil { - return fmt.Errorf("failed to parse string as float64: %w", err) - } - - if v.Kind() == reflect.Ptr { - if v.IsNil() { - v.Set(reflect.New(typ)) - } - v = v.Elem() - } - - v.Set(reflect.ValueOf(b)) - return nil - } - case reflect.Map: - if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { - if v.CanAddr() { - return json.Unmarshal(value, v.Addr().Interface()) - } else { - return json.Unmarshal(value, v.Interface()) - } - } - - var unmarhsaled map[string]json.RawMessage - - if err := json.Unmarshal(value, &unmarhsaled); err != nil { - return err - } - - m := reflect.MakeMap(typ) - - for k, value := range unmarhsaled { - itemVal := reflect.New(typ.Elem()) - - if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { - return err - } - - m.SetMapIndex(reflect.ValueOf(k), itemVal.Elem()) - } - - v.Set(m) - return nil - case reflect.Slice, reflect.Array: - var unmarshaled []json.RawMessage - - if err := json.Unmarshal(value, &unmarshaled); err != nil { - return err - } - - arrVal := reflect.MakeSlice(typ, len(unmarshaled), len(unmarshaled)) - - for index, value := range unmarshaled { - itemVal := reflect.New(typ.Elem()) - - if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { - return err - } - - arrVal.Index(index).Set(itemVal.Elem()) - } - - if v.Kind() == reflect.Pointer { - if v.IsNil() { - v.Set(reflect.New(typ)) - } - v = v.Elem() - } - - v.Set(arrVal) - return nil - case reflect.Struct: - switch typ { - case reflect.TypeOf(time.Time{}): - var s string - if err := json.Unmarshal(value, &s); err != nil { - return err - } - - t, err := time.Parse(time.RFC3339Nano, s) - if err != nil { - return fmt.Errorf("failed to parse string as time.Time: %w", err) - } - - if v.Kind() == reflect.Ptr { - if v.IsNil() { - v.Set(reflect.New(typ)) - } - v = v.Elem() - } - - v.Set(reflect.ValueOf(t)) - return nil - case reflect.TypeOf(big.Int{}): - var b *big.Int - - format := tag.Get("bigint") - if format == "string" { - var s string - if err := json.Unmarshal(value, &s); err != nil { - return err - } - - var ok bool - b, ok = new(big.Int).SetString(s, 10) - if !ok { - return fmt.Errorf("failed to parse string as big.Int") - } - } else { - if err := json.Unmarshal(value, &b); err != nil { - return err - } - } - - if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { - v = v.Elem() - } - - v.Set(reflect.ValueOf(b)) - return nil - case reflect.TypeOf(decimal.Big{}): - var d *decimal.Big - format := tag.Get("decimal") - if format == "number" { - var ok bool - d, ok = new(decimal.Big).SetString(string(value)) - if !ok { - return fmt.Errorf("failed to parse number as decimal.Big") - } - } else { - if err := json.Unmarshal(value, &d); err != nil { - return err - } - } - - if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { - v = v.Elem() - } - - v.Set(reflect.ValueOf(d)) - return nil - case reflect.TypeOf(types.Date{}): - var s string - - if err := json.Unmarshal(value, &s); err != nil { - return err - } - - d, err := types.DateFromString(s) - if err != nil { - return fmt.Errorf("failed to parse string as types.Date: %w", err) - } - - if v.Kind() == reflect.Ptr { - if v.IsNil() { - v.Set(reflect.New(typ)) - } - v = v.Elem() - } - - v.Set(reflect.ValueOf(d)) - return nil - } - } - - var val interface{} - - if v.CanAddr() { - val = v.Addr().Interface() - } else { - val = v.Interface() - } - - d := json.NewDecoder(bytes.NewReader(value)) - if disallowUnknownFields { - d.DisallowUnknownFields() - } - return d.Decode(val) -} - -func dereferencePointers(typ reflect.Type, val reflect.Value) (reflect.Type, reflect.Value) { - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - val = val.Elem() - } else { - return typ, val - } - - return dereferencePointers(typ, val) -} - -func dereferenceTypePointer(typ reflect.Type) reflect.Type { - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - } else { - return typ - } - - return dereferenceTypePointer(typ) -} - -func isComplexValueType(typ reflect.Type) bool { - switch typ.Kind() { - case reflect.Struct: - switch typ { - case reflect.TypeOf(time.Time{}): - fallthrough - case reflect.TypeOf(big.Int{}): - fallthrough - case reflect.TypeOf(decimal.Big{}): - fallthrough - case reflect.TypeOf(types.Date{}): - return true - } - } - - return false -} - -func isModelType(typ reflect.Type) bool { - if isComplexValueType(typ) { - return false - } - - if typ.Kind() == reflect.Struct { - return true - } - - return false -} diff --git a/internal/sdk/internal/utils/pathparams.go b/internal/sdk/internal/utils/pathparams.go deleted file mode 100644 index 7975624..0000000 --- a/internal/sdk/internal/utils/pathparams.go +++ /dev/null @@ -1,172 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "context" - "fmt" - "math/big" - "net/url" - "reflect" - "strings" - "time" - - "github.com/ericlagergren/decimal" - - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" -) - -func GenerateURL(_ context.Context, serverURL, path string, pathParams interface{}, globals interface{}) (string, error) { - uri := strings.TrimSuffix(serverURL, "/") + path - - parsedParameters := map[string]string{} - - globalsAlreadyPopulated, err := populateParsedParameters(pathParams, globals, parsedParameters, []string{}) - if err != nil { - return "", err - } - - if globals != nil { - _, err = populateParsedParameters(globals, nil, parsedParameters, globalsAlreadyPopulated) - if err != nil { - return "", err - } - } - - // TODO should we handle the case where there are no matching path params? - return ReplaceParameters(uri, parsedParameters), nil -} - -func populateParsedParameters(pathParams interface{}, globals interface{}, parsedParameters map[string]string, skipFields []string) ([]string, error) { - pathParamsStructType, pathParamsValType := dereferencePointers(reflect.TypeOf(pathParams), reflect.ValueOf(pathParams)) - - globalsAlreadyPopulated := []string{} - - for i := 0; i < pathParamsStructType.NumField(); i++ { - fieldType := pathParamsStructType.Field(i) - valType := pathParamsValType.Field(i) - - if contains(skipFields, fieldType.Name) { - continue - } - - requestTag := getRequestTag(fieldType) - if requestTag != nil { - continue - } - - ppTag := parseParamTag(pathParamTagKey, fieldType, "simple", false) - if ppTag == nil { - continue - } - - if globals != nil { - var globalFound bool - fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, pathParamTagKey, globals) - if globalFound { - globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) - } - } - - if ppTag.Serialization != "" { - vals, err := populateSerializedParams(ppTag, fieldType.Type, valType) - if err != nil { - return nil, err - } - for k, v := range vals { - parsedParameters[k] = url.PathEscape(v) - } - } else { - // TODO: support other styles - switch ppTag.Style { - case "simple": - simpleParams := getSimplePathParams(ppTag.ParamName, fieldType.Type, valType, ppTag.Explode) - for k, v := range simpleParams { - parsedParameters[k] = v - } - } - } - } - - return globalsAlreadyPopulated, nil -} - -func getSimplePathParams(parentName string, objType reflect.Type, objValue reflect.Value, explode bool) map[string]string { - pathParams := make(map[string]string) - - if isNil(objType, objValue) { - return nil - } - - if objType.Kind() == reflect.Ptr { - objType = objType.Elem() - objValue = objValue.Elem() - } - - switch objType.Kind() { - case reflect.Array, reflect.Slice: - if objValue.Len() == 0 { - return nil - } - var ppVals []string - for i := 0; i < objValue.Len(); i++ { - ppVals = append(ppVals, valToString(objValue.Index(i).Interface())) - } - pathParams[parentName] = strings.Join(ppVals, ",") - case reflect.Map: - if objValue.Len() == 0 { - return nil - } - var ppVals []string - objMap := objValue.MapRange() - for objMap.Next() { - if explode { - ppVals = append(ppVals, fmt.Sprintf("%s=%s", objMap.Key().String(), valToString(objMap.Value().Interface()))) - } else { - ppVals = append(ppVals, fmt.Sprintf("%s,%s", objMap.Key().String(), valToString(objMap.Value().Interface()))) - } - } - pathParams[parentName] = strings.Join(ppVals, ",") - case reflect.Struct: - switch objValue.Interface().(type) { - case time.Time: - pathParams[parentName] = valToString(objValue.Interface()) - case types.Date: - pathParams[parentName] = valToString(objValue.Interface()) - case big.Int: - pathParams[parentName] = valToString(objValue.Interface()) - case decimal.Big: - pathParams[parentName] = valToString(objValue.Interface()) - default: - var ppVals []string - for i := 0; i < objType.NumField(); i++ { - fieldType := objType.Field(i) - valType := objValue.Field(i) - - ppTag := parseParamTag(pathParamTagKey, fieldType, "simple", explode) - if ppTag == nil { - continue - } - - if isNil(fieldType.Type, valType) { - continue - } - - if fieldType.Type.Kind() == reflect.Pointer { - valType = valType.Elem() - } - - if explode { - ppVals = append(ppVals, fmt.Sprintf("%s=%s", ppTag.ParamName, valToString(valType.Interface()))) - } else { - ppVals = append(ppVals, fmt.Sprintf("%s,%s", ppTag.ParamName, valToString(valType.Interface()))) - } - } - pathParams[parentName] = strings.Join(ppVals, ",") - } - default: - pathParams[parentName] = valToString(objValue.Interface()) - } - - return pathParams -} diff --git a/internal/sdk/internal/utils/queryparams.go b/internal/sdk/internal/utils/queryparams.go deleted file mode 100644 index 35ff5ea..0000000 --- a/internal/sdk/internal/utils/queryparams.go +++ /dev/null @@ -1,259 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "context" - "encoding/json" - "fmt" - "math/big" - "net/http" - "net/url" - "reflect" - "time" - - "github.com/ericlagergren/decimal" - - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" -) - -func PopulateQueryParams(_ context.Context, req *http.Request, queryParams interface{}, globals interface{}) error { - // Query parameters may already be present from overriding URL - if req.URL.RawQuery != "" { - return nil - } - - values := url.Values{} - - globalsAlreadyPopulated, err := populateQueryParams(queryParams, globals, values, []string{}) - if err != nil { - return err - } - - if globals != nil { - _, err = populateQueryParams(globals, nil, values, globalsAlreadyPopulated) - if err != nil { - return err - } - } - - req.URL.RawQuery = values.Encode() - - return nil -} - -func populateQueryParams(queryParams interface{}, globals interface{}, values url.Values, skipFields []string) ([]string, error) { - queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), reflect.ValueOf(queryParams)) - - globalsAlreadyPopulated := []string{} - - for i := 0; i < queryParamsStructType.NumField(); i++ { - fieldType := queryParamsStructType.Field(i) - valType := queryParamsValType.Field(i) - - if contains(skipFields, fieldType.Name) { - continue - } - - requestTag := getRequestTag(fieldType) - if requestTag != nil { - continue - } - - qpTag := parseQueryParamTag(fieldType) - if qpTag == nil { - continue - } - - if globals != nil { - var globalFound bool - fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, queryParamTagKey, globals) - if globalFound { - globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) - } - } - - if qpTag.Serialization != "" { - vals, err := populateSerializedParams(qpTag, fieldType.Type, valType) - if err != nil { - return nil, err - } - for k, v := range vals { - values.Add(k, v) - } - } else { - switch qpTag.Style { - case "deepObject": - vals := populateDeepObjectParams(qpTag, fieldType.Type, valType) - for k, v := range vals { - for _, vv := range v { - values.Add(k, vv) - } - } - case "form": - vals := populateFormParams(qpTag, fieldType.Type, valType, ",") - for k, v := range vals { - for _, vv := range v { - values.Add(k, vv) - } - } - case "pipeDelimited": - vals := populateFormParams(qpTag, fieldType.Type, valType, "|") - for k, v := range vals { - for _, vv := range v { - values.Add(k, vv) - } - } - default: - return nil, fmt.Errorf("unsupported style: %s", qpTag.Style) - } - } - } - - return globalsAlreadyPopulated, nil -} - -func populateSerializedParams(tag *paramTag, objType reflect.Type, objValue reflect.Value) (map[string]string, error) { - if isNil(objType, objValue) { - return nil, nil - } - - if objType.Kind() == reflect.Pointer { - objValue = objValue.Elem() - } - - values := map[string]string{} - - switch tag.Serialization { - case "json": - data, err := json.Marshal(objValue.Interface()) - if err != nil { - return nil, fmt.Errorf("error marshaling json: %v", err) - } - values[tag.ParamName] = string(data) - } - - return values, nil -} - -func populateDeepObjectParams(tag *paramTag, objType reflect.Type, objValue reflect.Value) url.Values { - values := url.Values{} - - if isNil(objType, objValue) { - return values - } - - if objValue.Kind() == reflect.Pointer { - objValue = objValue.Elem() - } - - switch objValue.Kind() { - case reflect.Map: - populateDeepObjectParamsMap(values, tag.ParamName, objValue) - case reflect.Struct: - populateDeepObjectParamsStruct(values, tag.ParamName, objValue) - } - - return values -} - -func populateDeepObjectParamsArray(qsValues url.Values, priorScope string, value reflect.Value) { - if value.Kind() != reflect.Array && value.Kind() != reflect.Slice { - return - } - - for i := 0; i < value.Len(); i++ { - qsValues.Add(priorScope, valToString(value.Index(i).Interface())) - } -} - -func populateDeepObjectParamsMap(qsValues url.Values, priorScope string, mapValue reflect.Value) { - if mapValue.Kind() != reflect.Map { - return - } - - iter := mapValue.MapRange() - - for iter.Next() { - scope := priorScope + "[" + iter.Key().String() + "]" - iterValue := iter.Value() - - switch iterValue.Kind() { - case reflect.Array, reflect.Slice: - populateDeepObjectParamsArray(qsValues, scope, iterValue) - case reflect.Map: - populateDeepObjectParamsMap(qsValues, scope, iterValue) - default: - qsValues.Add(scope, valToString(iterValue.Interface())) - } - } -} - -func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, structValue reflect.Value) { - if structValue.Kind() != reflect.Struct { - return - } - - structType := structValue.Type() - - for i := 0; i < structType.NumField(); i++ { - field := structType.Field(i) - fieldValue := structValue.Field(i) - - if isNil(field.Type, fieldValue) { - continue - } - - if fieldValue.Kind() == reflect.Pointer { - fieldValue = fieldValue.Elem() - } - - qpTag := parseQueryParamTag(field) - - if qpTag == nil { - continue - } - - scope := priorScope + "[" + qpTag.ParamName + "]" - - switch fieldValue.Kind() { - case reflect.Array, reflect.Slice: - populateDeepObjectParamsArray(qsValues, scope, fieldValue) - case reflect.Map: - populateDeepObjectParamsMap(qsValues, scope, fieldValue) - case reflect.Struct: - switch fieldValue.Type() { - case reflect.TypeOf(big.Int{}), reflect.TypeOf(decimal.Big{}), reflect.TypeOf(time.Time{}), reflect.TypeOf(types.Date{}): - qsValues.Add(scope, valToString(fieldValue.Interface())) - - continue - } - - populateDeepObjectParamsStruct(qsValues, scope, fieldValue) - default: - qsValues.Add(scope, valToString(fieldValue.Interface())) - } - } -} - -func populateFormParams(tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string) url.Values { - return populateForm(tag.ParamName, tag.Explode, objType, objValue, delimiter, func(fieldType reflect.StructField) string { - qpTag := parseQueryParamTag(fieldType) - if qpTag == nil { - return "" - } - - return qpTag.ParamName - }) -} - -type paramTag struct { - Style string - Explode bool - ParamName string - Serialization string -} - -func parseQueryParamTag(field reflect.StructField) *paramTag { - return parseParamTag(queryParamTagKey, field, "form", true) -} diff --git a/internal/sdk/internal/utils/requestbody.go b/internal/sdk/internal/utils/requestbody.go deleted file mode 100644 index 000226e..0000000 --- a/internal/sdk/internal/utils/requestbody.go +++ /dev/null @@ -1,416 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "bytes" - "context" - "fmt" - "io" - "mime/multipart" - "net/url" - "reflect" - "regexp" -) - -const ( - requestTagKey = "request" - multipartFormTagKey = "multipartForm" - formTagKey = "form" -) - -var ( - jsonEncodingRegex = regexp.MustCompile(`(application|text)\/.*?\+*json.*`) - multipartEncodingRegex = regexp.MustCompile(`multipart\/.*`) - urlEncodedEncodingRegex = regexp.MustCompile(`application\/x-www-form-urlencoded.*`) -) - -func SerializeRequestBody(_ context.Context, request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { - bodyReader, contentType, err := serializeRequestBody(request, nullable, optional, requestFieldName, serializationMethod, tag) - if err != nil { - return nil, "", fmt.Errorf("error serializing request body: %w", err) - } - - if bodyReader == nil && !optional { - return nil, "", fmt.Errorf("request body is required") - } - - return bodyReader, contentType, nil -} - -func serializeRequestBody(request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { - requestStructType := reflect.TypeOf(request) - requestValType := reflect.ValueOf(request) - - if isNil(requestStructType, requestValType) { - if !nullable && optional { - return nil, "", nil - } - - return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType, tag) - } - - if requestStructType.Kind() == reflect.Pointer { - requestStructType = requestStructType.Elem() - requestValType = requestValType.Elem() - } - - if requestStructType.Kind() != reflect.Struct { - return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType, tag) - } - - requestField, ok := requestStructType.FieldByName(requestFieldName) - - if ok { - tag := getRequestTag(requestField) - if tag != nil { - // request object (non-flattened) - requestVal := requestValType.FieldByName(requestFieldName) - val := reflect.ValueOf(requestVal.Interface()) - if isNil(requestField.Type, requestVal) { - if !nullable && optional { - return nil, "", nil - } - - return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) - } - - return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) - } - } - - // flattened request object - return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], reflect.ValueOf(request), tag) -} - -func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (io.Reader, string, error) { - buf := &bytes.Buffer{} - - if isNil(val.Type(), val) { - // TODO: what does a null mean for other content types? Just returning an empty buffer for now - if jsonEncodingRegex.MatchString(mediaType) { - if _, err := buf.Write([]byte("null")); err != nil { - return nil, "", err - } - } - - return buf, mediaType, nil - } - - switch { - case jsonEncodingRegex.MatchString(mediaType): - data, err := MarshalJSON(val.Interface(), reflect.StructTag(tag), true) - if err != nil { - return nil, "", err - } - - if _, err := buf.Write(data); err != nil { - return nil, "", err - } - case multipartEncodingRegex.MatchString(mediaType): - var err error - mediaType, err = encodeMultipartFormData(buf, val.Interface()) - if err != nil { - return nil, "", err - } - case urlEncodedEncodingRegex.MatchString(mediaType): - if err := encodeFormData(fieldName, buf, val.Interface()); err != nil { - return nil, "", err - } - case val.Type().Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()): - return val.Interface().(io.Reader), mediaType, nil - default: - val = reflect.Indirect(val) - - switch { - case val.Type().Kind() == reflect.String: - if _, err := buf.WriteString(valToString(val.Interface())); err != nil { - return nil, "", err - } - case reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)): - if _, err := buf.Write(val.Interface().([]byte)); err != nil { - return nil, "", err - } - default: - return nil, "", fmt.Errorf("invalid request body type %s for mediaType %s", val.Type(), mediaType) - } - } - - return buf, mediaType, nil -} - -func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { - requestStructType := reflect.TypeOf(data) - requestValType := reflect.ValueOf(data) - - if requestStructType.Kind() == reflect.Pointer { - requestStructType = requestStructType.Elem() - requestValType = requestValType.Elem() - } - - writer := multipart.NewWriter(w) - - for i := 0; i < requestStructType.NumField(); i++ { - field := requestStructType.Field(i) - fieldType := field.Type - valType := requestValType.Field(i) - - if isNil(fieldType, valType) { - continue - } - - if fieldType.Kind() == reflect.Pointer { - fieldType = fieldType.Elem() - valType = valType.Elem() - } - - tag := parseMultipartFormTag(field) - if tag.File { - if err := encodeMultipartFormDataFile(writer, fieldType, valType); err != nil { - writer.Close() - return "", err - } - } else if tag.JSON { - jw, err := writer.CreateFormField(tag.Name) - if err != nil { - writer.Close() - return "", err - } - d, err := MarshalJSON(valType.Interface(), field.Tag, true) - if err != nil { - writer.Close() - return "", err - } - if _, err := jw.Write(d); err != nil { - writer.Close() - return "", err - } - } else { - switch fieldType.Kind() { - case reflect.Slice, reflect.Array: - values := parseDelimitedArray(true, valType, ",") - for _, v := range values { - if err := writer.WriteField(tag.Name+"[]", v); err != nil { - writer.Close() - return "", err - } - } - default: - if err := writer.WriteField(tag.Name, valToString(valType.Interface())); err != nil { - writer.Close() - return "", err - } - } - } - } - - if err := writer.Close(); err != nil { - return "", err - } - - return writer.FormDataContentType(), nil -} - -func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, valType reflect.Value) error { - if fieldType.Kind() != reflect.Struct { - return fmt.Errorf("invalid type %s for multipart/form-data file", valType.Type()) - } - - var fieldName string - var fileName string - var reader io.Reader - - for i := 0; i < fieldType.NumField(); i++ { - field := fieldType.Field(i) - val := valType.Field(i) - - tag := parseMultipartFormTag(field) - if !tag.Content && tag.Name == "" { - continue - } - - if tag.Content && val.CanInterface() { - if reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)) { - reader = bytes.NewReader(val.Interface().([]byte)) - } else if reflect.TypeOf(val.Interface()).Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()) { - reader = val.Interface().(io.Reader) - } - } else { - fieldName = tag.Name - fileName = val.String() - } - } - - if fieldName == "" || fileName == "" || reader == nil { - return fmt.Errorf("invalid multipart/form-data file") - } - - fw, err := w.CreateFormFile(fieldName, fileName) - if err != nil { - return err - } - if _, err := io.Copy(fw, reader); err != nil { - return err - } - - return nil -} - -func encodeFormData(fieldName string, w io.Writer, data interface{}) error { - requestType := reflect.TypeOf(data) - requestValType := reflect.ValueOf(data) - - if requestType.Kind() == reflect.Pointer { - requestType = requestType.Elem() - requestValType = requestValType.Elem() - } - - dataValues := url.Values{} - - switch requestType.Kind() { - case reflect.Struct: - for i := 0; i < requestType.NumField(); i++ { - field := requestType.Field(i) - fieldType := field.Type - valType := requestValType.Field(i) - - if isNil(fieldType, valType) { - continue - } - - if fieldType.Kind() == reflect.Pointer { - fieldType = fieldType.Elem() - valType = valType.Elem() - } - - tag := parseFormTag(field) - if tag.JSON { - data, err := MarshalJSON(valType.Interface(), field.Tag, true) - if err != nil { - return err - } - dataValues.Set(tag.Name, string(data)) - } else { - switch tag.Style { - // TODO: support other styles - case "form": - values := populateForm(tag.Name, tag.Explode, fieldType, valType, ",", func(sf reflect.StructField) string { - tag := parseFormTag(field) - if tag == nil { - return "" - } - - return tag.Name - }) - for k, v := range values { - for _, vv := range v { - dataValues.Add(k, vv) - } - } - } - } - } - case reflect.Map: - for _, k := range requestValType.MapKeys() { - v := requestValType.MapIndex(k) - dataValues.Set(fmt.Sprintf("%v", k.Interface()), valToString(v.Interface())) - } - case reflect.Slice, reflect.Array: - for i := 0; i < requestValType.Len(); i++ { - v := requestValType.Index(i) - dataValues.Set(fieldName, valToString(v.Interface())) - } - } - - if _, err := w.Write([]byte(dataValues.Encode())); err != nil { - return err - } - - return nil -} - -type requestTag struct { - MediaType string -} - -func getRequestTag(field reflect.StructField) *requestTag { - // example `request:"mediaType=multipart/form-data"` - values := parseStructTag(requestTagKey, field) - if values == nil { - return nil - } - - tag := &requestTag{ - MediaType: "application/octet-stream", - } - - for k, v := range values { - switch k { - case "mediaType": - tag.MediaType = v - } - } - - return tag -} - -type multipartFormTag struct { - File bool - Content bool - JSON bool - Name string -} - -func parseMultipartFormTag(field reflect.StructField) *multipartFormTag { - // example `multipartForm:"name=file"` - values := parseStructTag(multipartFormTagKey, field) - - tag := &multipartFormTag{} - - for k, v := range values { - switch k { - case "file": - tag.File = v == "true" - case "content": - tag.Content = v == "true" - case "name": - tag.Name = v - case "json": - tag.JSON = v == "true" - } - } - - return tag -} - -type formTag struct { - Name string - JSON bool - Style string - Explode bool -} - -func parseFormTag(field reflect.StructField) *formTag { - // example `form:"name=propName,style=spaceDelimited,explode"` - values := parseStructTag(formTagKey, field) - - tag := &formTag{ - Style: "form", - Explode: true, - } - - for k, v := range values { - switch k { - case "name": - tag.Name = v - case "json": - tag.JSON = v == "true" - case "style": - tag.Style = v - case "explode": - tag.Explode = v == "true" - } - } - - return tag -} diff --git a/internal/sdk/internal/utils/retries.go b/internal/sdk/internal/utils/retries.go deleted file mode 100644 index b15533e..0000000 --- a/internal/sdk/internal/utils/retries.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "context" - "errors" - "fmt" - "github.com/cenkalti/backoff/v4" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/retry" - "net/http" - "net/url" - "strconv" - "strings" - "time" -) - -var errRequestFailed = errors.New("request failed") - -// Deprecated: Use retry.BackoffStrategy instead. -type BackoffStrategy = retry.BackoffStrategy - -// Deprecated: Use retry.Config instead. -type RetryConfig = retry.Config - -type Retries struct { - Config *retry.Config - StatusCodes []string -} - -func Retry(ctx context.Context, r Retries, action func() (*http.Response, error)) (*http.Response, error) { - switch r.Config.Strategy { - case "backoff": - if r.Config.Backoff == nil { - return action() - } - - config := backoff.NewExponentialBackOff() - config.InitialInterval = time.Duration(r.Config.Backoff.InitialInterval) * time.Millisecond - config.MaxInterval = time.Duration(r.Config.Backoff.MaxInterval) * time.Millisecond - config.Multiplier = r.Config.Backoff.Exponent - config.MaxElapsedTime = time.Duration(r.Config.Backoff.MaxElapsedTime) * time.Millisecond - config.Reset() - - var resp *http.Response - - err := backoff.Retry(func() error { - if resp != nil { - resp.Body.Close() - } - - select { - case <-ctx.Done(): - return backoff.Permanent(ctx.Err()) - default: - } - - res, err := action() - if err != nil { - urlError := new(url.Error) - if errors.As(err, &urlError) { - if (urlError.Temporary() || urlError.Timeout()) && r.Config.RetryConnectionErrors { - return err - } - } - - return backoff.Permanent(err) - } - resp = res - if res == nil { - return fmt.Errorf("no response") - } - - for _, code := range r.StatusCodes { - if strings.Contains(strings.ToUpper(code), "X") { - codeRange, err := strconv.Atoi(code[:1]) - if err != nil { - continue - } - - s := res.StatusCode / 100 - - if s >= codeRange && s < codeRange+1 { - return errRequestFailed - } - } else { - parsedCode, err := strconv.Atoi(code) - if err != nil { - continue - } - - if res.StatusCode == parsedCode { - return errRequestFailed - } - } - } - - resp = res - - return nil - }, config) - if err != nil && !errors.Is(err, errRequestFailed) { - return nil, err - } - - return resp, nil - default: - return action() - } -} diff --git a/internal/sdk/internal/utils/security.go b/internal/sdk/internal/utils/security.go deleted file mode 100644 index 19dfa6f..0000000 --- a/internal/sdk/internal/utils/security.go +++ /dev/null @@ -1,285 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "context" - "encoding/base64" - "fmt" - "net/http" - "reflect" - "strings" -) - -const ( - securityTagKey = "security" -) - -type securityTag struct { - Option bool - Scheme bool - Name string - Type string - SubType string - Env string -} - -func PopulateSecurity(ctx context.Context, req *http.Request, securitySource func(context.Context) (interface{}, error)) error { - if securitySource == nil { - return nil - } - - security, err := securitySource(ctx) - if err != nil { - return err - } - - headers := make(map[string]string) - queryParams := make(map[string]string) - - securityValType := trueReflectValue(reflect.ValueOf(security)) - securityStructType := securityValType.Type() - - if isNil(securityStructType, securityValType) { - return nil - } - - if securityStructType.Kind() == reflect.Ptr { - securityStructType = securityStructType.Elem() - securityValType = securityValType.Elem() - } - - for i := 0; i < securityStructType.NumField(); i++ { - fieldType := securityStructType.Field(i) - valType := securityValType.Field(i) - - kind := valType.Kind() - - if isNil(fieldType.Type, valType) { - continue - } - - if fieldType.Type.Kind() == reflect.Pointer { - kind = valType.Elem().Kind() - } - - secTag := parseSecurityTag(fieldType) - if secTag != nil { - if secTag.Option { - handleSecurityOption(headers, queryParams, valType.Interface()) - } else if secTag.Scheme { - // Special case for basic auth which could be a flattened struct - if secTag.SubType == "basic" && kind != reflect.Struct { - parseSecurityScheme(headers, queryParams, secTag, security) - } else { - parseSecurityScheme(headers, queryParams, secTag, valType.Interface()) - } - } - } - } - - for key, value := range headers { - req.Header.Add(key, value) - } - - query := req.URL.Query() - for key, value := range queryParams { - query.Add(key, value) - } - req.URL.RawQuery = query.Encode() - - return nil -} - -func handleSecurityOption(headers, queryParams map[string]string, option interface{}) { - optionValType := trueReflectValue(reflect.ValueOf(option)) - optionStructType := optionValType.Type() - - if isNil(optionStructType, optionValType) { - return - } - - for i := 0; i < optionStructType.NumField(); i++ { - fieldType := optionStructType.Field(i) - valType := optionValType.Field(i) - - secTag := parseSecurityTag(fieldType) - if secTag != nil && secTag.Scheme { - parseSecurityScheme(headers, queryParams, secTag, valType.Interface()) - } - } -} - -func parseSecurityScheme(headers, queryParams map[string]string, schemeTag *securityTag, scheme interface{}) { - schemeVal := trueReflectValue(reflect.ValueOf(scheme)) - schemeType := schemeVal.Type() - - if isNil(schemeType, schemeVal) { - return - } - - if schemeType.Kind() == reflect.Struct { - if schemeTag.Type == "http" { - switch schemeTag.SubType { - case "basic": - handleBasicAuthScheme(headers, schemeVal.Interface()) - return - case "custom": - return - } - } - - for i := 0; i < schemeType.NumField(); i++ { - fieldType := schemeType.Field(i) - valType := schemeVal.Field(i) - - if isNil(fieldType.Type, valType) { - continue - } - - if fieldType.Type.Kind() == reflect.Ptr { - valType = valType.Elem() - } - - secTag := parseSecurityTag(fieldType) - if secTag == nil || secTag.Name == "" { - return - } - - parseSecuritySchemeValue(headers, queryParams, schemeTag, secTag, valType.Interface()) - } - } else { - parseSecuritySchemeValue(headers, queryParams, schemeTag, schemeTag, schemeVal.Interface()) - } -} - -func parseSecuritySchemeValue(headers, queryParams map[string]string, schemeTag *securityTag, secTag *securityTag, val interface{}) { - switch schemeTag.Type { - case "apiKey": - switch schemeTag.SubType { - case "header": - headers[secTag.Name] = valToString(val) - case "query": - queryParams[secTag.Name] = valToString(val) - case "cookie": - headers["Cookie"] = fmt.Sprintf("%s=%s", secTag.Name, valToString(val)) - default: - panic("not supported") - } - case "openIdConnect": - headers[secTag.Name] = prefixBearer(valToString(val)) - case "oauth2": - if schemeTag.SubType != "client_credentials" { - headers[secTag.Name] = prefixBearer(valToString(val)) - } - case "http": - switch schemeTag.SubType { - case "bearer": - headers[secTag.Name] = prefixBearer(valToString(val)) - case "custom": - default: - panic("not supported") - } - default: - panic("not supported") - } -} - -func prefixBearer(authHeaderValue string) string { - if strings.HasPrefix(strings.ToLower(authHeaderValue), "bearer ") { - return authHeaderValue - } - - return fmt.Sprintf("Bearer %s", authHeaderValue) -} - -func handleBasicAuthScheme(headers map[string]string, scheme interface{}) { - schemeStructType := reflect.TypeOf(scheme) - schemeValType := reflect.ValueOf(scheme) - - var username, password string - - for i := 0; i < schemeStructType.NumField(); i++ { - fieldType := schemeStructType.Field(i) - valType := schemeValType.Field(i) - - if fieldType.Type.Kind() == reflect.Ptr { - valType = valType.Elem() - } - - secTag := parseSecurityTag(fieldType) - if secTag == nil || secTag.Name == "" { - continue - } - - switch secTag.Name { - case "username": - username = valType.String() - case "password": - password = valType.String() - } - } - - headers["Authorization"] = fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))) -} - -func parseSecurityTag(field reflect.StructField) *securityTag { - tag := field.Tag.Get(securityTagKey) - if tag == "" { - return nil - } - - option := false - scheme := false - name := "" - securityType := "" - securitySubType := "" - env := "" - - options := strings.Split(tag, ",") - for _, optionConf := range options { - parts := strings.Split(optionConf, "=") - if len(parts) < 1 || len(parts) > 2 { - continue - } - - switch parts[0] { - case "name": - name = parts[1] - case "type": - securityType = parts[1] - case "subtype": - securitySubType = parts[1] - case "option": - option = true - case "scheme": - scheme = true - case "env": - env = parts[1] - } - } - - // TODO: validate tag? - - return &securityTag{ - Option: option, - Scheme: scheme, - Name: name, - Type: securityType, - SubType: securitySubType, - Env: env, - } -} - -func trueReflectValue(val reflect.Value) reflect.Value { - kind := val.Type().Kind() - for kind == reflect.Interface || kind == reflect.Ptr { - innerVal := val.Elem() - if !innerVal.IsValid() { - break - } - val = innerVal - kind = val.Type().Kind() - } - return val -} diff --git a/internal/sdk/internal/utils/utils.go b/internal/sdk/internal/utils/utils.go deleted file mode 100644 index f1ff9e0..0000000 --- a/internal/sdk/internal/utils/utils.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package utils - -import ( - "bytes" - "context" - "fmt" - "io" - "math/big" - "net/http" - "reflect" - "regexp" - "strconv" - "strings" - "time" - - "github.com/ericlagergren/decimal" -) - -const ( - queryParamTagKey = "queryParam" - headerParamTagKey = "header" - pathParamTagKey = "pathParam" -) - -var ( - paramRegex = regexp.MustCompile(`({.*?})`) - SerializationMethodToContentType = map[string]string{ - "json": "application/json", - "form": "application/x-www-form-urlencoded", - "multipart": "multipart/form-data", - "raw": "application/octet-stream", - "string": "text/plain", - } -) - -func UnmarshalJsonFromResponseBody(body io.Reader, out interface{}, tag string) error { - data, err := io.ReadAll(body) - if err != nil { - return fmt.Errorf("error reading response body: %w", err) - } - if err := UnmarshalJSON(data, out, reflect.StructTag(tag), true, false); err != nil { - return fmt.Errorf("error unmarshalling json response body: %w", err) - } - - return nil -} - -func ReplaceParameters(stringWithParams string, params map[string]string) string { - if len(params) == 0 { - return stringWithParams - } - - return paramRegex.ReplaceAllStringFunc(stringWithParams, func(match string) string { - match = match[1 : len(match)-1] - return params[match] - }) -} - -func Contains(slice []string, item string) bool { - for _, s := range slice { - if s == item { - return true - } - } - return false -} - -func MatchStatusCodes(expectedCodes []string, statusCode int) bool { - for _, codeStr := range expectedCodes { - code, err := strconv.Atoi(codeStr) - if err == nil { - if code == statusCode { - return true - } - continue - } - - codeRange, err := strconv.Atoi(string(codeStr[0])) - if err != nil { - continue - } - - if statusCode >= (codeRange*100) && statusCode < ((codeRange+1)*100) { - return true - } - } - - return false -} - -func AsSecuritySource(security interface{}) func(context.Context) (interface{}, error) { - return func(context.Context) (interface{}, error) { - return security, nil - } -} - -func parseStructTag(tagKey string, field reflect.StructField) map[string]string { - tag := field.Tag.Get(tagKey) - if tag == "" { - return nil - } - - values := map[string]string{} - - options := strings.Split(tag, ",") - for _, optionConf := range options { - parts := strings.Split(optionConf, "=") - - switch len(parts) { - case 1: - // flag option - parts = append(parts, "true") - case 2: - // key=value option - default: - // invalid option - continue - } - - values[parts[0]] = parts[1] - } - - return values -} - -func parseParamTag(tagKey string, field reflect.StructField, defaultStyle string, defaultExplode bool) *paramTag { - // example `{tagKey}:"style=simple,explode=false,name=apiID"` - values := parseStructTag(tagKey, field) - if values == nil { - return nil - } - - tag := ¶mTag{ - Style: defaultStyle, - Explode: defaultExplode, - ParamName: strings.ToLower(field.Name), - } - - for k, v := range values { - switch k { - case "style": - tag.Style = v - case "explode": - tag.Explode = v == "true" - case "name": - tag.ParamName = v - case "serialization": - tag.Serialization = v - } - } - - return tag -} - -func valToString(val interface{}) string { - switch v := val.(type) { - case time.Time: - return v.Format(time.RFC3339Nano) - case big.Int: - return v.String() - case decimal.Big: - return v.String() - default: - return fmt.Sprintf("%v", v) - } -} - -func populateFromGlobals(fieldType reflect.StructField, valType reflect.Value, paramType string, globals interface{}) (reflect.StructField, reflect.Value, bool) { - if globals == nil { - return fieldType, valType, false - } - - globalsStruct := reflect.TypeOf(globals) - globalsStructVal := reflect.ValueOf(globals) - - globalsField, found := globalsStruct.FieldByName(fieldType.Name) - if !found { - return fieldType, valType, false - } - - if fieldType.Type.Kind() != reflect.Ptr || !valType.IsNil() { - return fieldType, valType, true - } - - globalsVal := globalsStructVal.FieldByName(fieldType.Name) - - if !globalsVal.IsValid() { - return fieldType, valType, false - } - - switch paramType { - case queryParamTagKey: - qpTag := parseQueryParamTag(globalsField) - if qpTag == nil { - return fieldType, valType, false - } - default: - tag := parseParamTag(paramType, fieldType, "simple", false) - if tag == nil { - return fieldType, valType, false - } - } - - return globalsField, globalsVal, true -} - -func isNil(typ reflect.Type, val reflect.Value) bool { - // `reflect.TypeOf(nil) == nil` so calling typ.Kind() will cause a nil pointer - // dereference panic. Catch it and return early. - // https://github.com/golang/go/issues/51649 - // https://github.com/golang/go/issues/54208 - if typ == nil { - return true - } - - if typ.Kind() == reflect.Ptr || typ.Kind() == reflect.Map || typ.Kind() == reflect.Slice || typ.Kind() == reflect.Interface { - return val.IsNil() - } - - return false -} - -func contains(arr []string, str string) bool { - for _, a := range arr { - if a == str { - return true - } - } - return false -} - -func ConsumeRawBody(res *http.Response) ([]byte, error) { - rawBody, err := io.ReadAll(res.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - - res.Body.Close() - res.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - - return rawBody, nil -} diff --git a/internal/sdk/lifecycles.go b/internal/sdk/lifecycles.go deleted file mode 100644 index c786414..0000000 --- a/internal/sdk/lifecycles.go +++ /dev/null @@ -1,918 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Lifecycles - Operations about lifecycles -type Lifecycles struct { - MeasurementDefinitions *MeasurementDefinitions - - sdkConfiguration sdkConfiguration -} - -func newLifecycles(sdkConfig sdkConfiguration) *Lifecycles { - return &Lifecycles{ - sdkConfiguration: sdkConfig, - MeasurementDefinitions: newMeasurementDefinitions(sdkConfig), - } -} - -// CreateMeasurementDefinition - Create a measurement definition -// Create a new measurement definition -func (s *Lifecycles) CreateMeasurementDefinition(ctx context.Context, request operations.PostV1LifecyclesMeasurementDefinitionsRequestBody, opts ...operations.Option) (*operations.PostV1LifecyclesMeasurementDefinitionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1LifecyclesMeasurementDefinitions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/lifecycles/measurement_definitions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1LifecyclesMeasurementDefinitionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ArchiveMeasurementDefinition - Archive a measurement definition -// Archives a measurement definition which will hide it from lists and metrics -func (s *Lifecycles) ArchiveMeasurementDefinition(ctx context.Context, request operations.DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest, opts ...operations.Option) (*operations.DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/lifecycles/measurement_definitions/{measurement_definition_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateMeasurementDefinition - Update a measurement definition -// Update a single measurement definition from its ID -func (s *Lifecycles) UpdateMeasurementDefinition(ctx context.Context, request operations.PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest, opts ...operations.Option) (*operations.PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/lifecycles/measurement_definitions/{measurement_definition_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetMeasurementDefinition - Retrieve a measurement definition -// Retrieve a single measurement definition from its ID -func (s *Lifecycles) GetMeasurementDefinition(ctx context.Context, request operations.GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest, opts ...operations.Option) (*operations.GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1LifecyclesMeasurementDefinitionsMeasurementDefinitionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/lifecycles/measurement_definitions/{measurement_definition_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListPhases - List all phases and milestones -// List all of the lifecycle phases and milestones in the organization -func (s *Lifecycles) ListPhases(ctx context.Context, opts ...operations.Option) (*operations.GetV1LifecyclesPhasesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1LifecyclesPhases", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/lifecycles/phases") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1LifecyclesPhasesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.LifecyclesPhaseEntityList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.LifecyclesPhaseEntityList = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateMilestone - Create a milestone -// Create a new milestone -func (s *Lifecycles) CreateMilestone(ctx context.Context, request operations.PostV1LifecyclesMilestonesRequestBody, opts ...operations.Option) (*operations.PostV1LifecyclesMilestonesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1LifecyclesMilestones", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/lifecycles/milestones") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1LifecyclesMilestonesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.LifecyclesPhaseEntityList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.LifecyclesPhaseEntityList = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteMilestone - Delete a milestone -// Delete a milestone -func (s *Lifecycles) DeleteMilestone(ctx context.Context, request operations.DeleteV1LifecyclesMilestonesMilestoneIDRequest, opts ...operations.Option) (*operations.DeleteV1LifecyclesMilestonesMilestoneIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1LifecyclesMilestonesMilestoneId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/lifecycles/milestones/{milestone_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1LifecyclesMilestonesMilestoneIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.LifecyclesPhaseEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.LifecyclesPhaseEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateMilestone - Update a milestone -// Update a milestone -func (s *Lifecycles) UpdateMilestone(ctx context.Context, request operations.PatchV1LifecyclesMilestonesMilestoneIDRequest, opts ...operations.Option) (*operations.PatchV1LifecyclesMilestonesMilestoneIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1LifecyclesMilestonesMilestoneId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/lifecycles/milestones/{milestone_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1LifecyclesMilestonesMilestoneIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.LifecyclesPhaseEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.LifecyclesPhaseEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/links.go b/internal/sdk/links.go deleted file mode 100644 index 57865a9..0000000 --- a/internal/sdk/links.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type Links struct { - sdkConfiguration sdkConfiguration -} - -func newLinks(sdkConfig sdkConfiguration) *Links { - return &Links{ - sdkConfiguration: sdkConfig, - } -} - -// Update - Updates the external incident link -// Updates the external incident link attributes -func (s *Links) Update(ctx context.Context, request operations.PutV1IncidentsIncidentIDLinksLinkIDRequest, opts ...operations.Option) (*operations.PutV1IncidentsIncidentIDLinksLinkIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1IncidentsIncidentIdLinksLinkId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/links/{link_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PutV1IncidentsIncidentIDLinksLinkID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1IncidentsIncidentIDLinksLinkIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/measurementdefinitions.go b/internal/sdk/measurementdefinitions.go deleted file mode 100644 index 3d860f7..0000000 --- a/internal/sdk/measurementdefinitions.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" - "net/url" -) - -type MeasurementDefinitions struct { - sdkConfiguration sdkConfiguration -} - -func newMeasurementDefinitions(sdkConfig sdkConfiguration) *MeasurementDefinitions { - return &MeasurementDefinitions{ - sdkConfiguration: sdkConfig, - } -} - -// List all measurement definitions -// List all of the measurement definitions in the organization -func (s *MeasurementDefinitions) List(ctx context.Context, request operations.GetV1LifecyclesMeasurementDefinitionsRequest, opts ...operations.Option) (*operations.GetV1LifecyclesMeasurementDefinitionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1LifecyclesMeasurementDefinitions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/lifecycles/measurement_definitions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1LifecyclesMeasurementDefinitionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/metrics.go b/internal/sdk/metrics.go deleted file mode 100644 index 2dd7b2d..0000000 --- a/internal/sdk/metrics.go +++ /dev/null @@ -1,1020 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Metrics - Operations about metrics -type Metrics struct { - sdkConfiguration sdkConfiguration -} - -func newMetrics(sdkConfig sdkConfiguration) *Metrics { - return &Metrics{ - sdkConfiguration: sdkConfig, - } -} - -// GetTicketFunnel - List ticket task and follow up creation and completion metrics -// Returns a report with task and follow up creation and completion data -func (s *Metrics) GetTicketFunnel(ctx context.Context, request operations.GetV1MetricsTicketFunnelRequest, opts ...operations.Option) (*operations.GetV1MetricsTicketFunnelResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1MetricsTicketFunnel", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/metrics/ticket_funnel") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "GetV1MetricsTicketFunnel", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1MetricsTicketFunnelResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.MetricsTicketFunnelMetricsEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.MetricsTicketFunnelMetricsEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListRetrospectives - List retrospective metrics -// Returns a report with retrospective analytics data -func (s *Metrics) ListRetrospectives(ctx context.Context, request operations.GetV1MetricsRetrospectivesRequest, opts ...operations.Option) (*operations.GetV1MetricsRetrospectivesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1MetricsRetrospectives", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/metrics/retrospectives") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1MetricsRetrospectivesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.MetricsRetrospectiveEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.MetricsRetrospectiveEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListFunnel - List funnel metrics -// Returns a report with time bucketed milestone data -func (s *Metrics) ListFunnel(ctx context.Context, request operations.GetV1MetricsMilestoneFunnelRequest, opts ...operations.Option) (*operations.GetV1MetricsMilestoneFunnelResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1MetricsMilestoneFunnel", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/metrics/milestone_funnel") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "GetV1MetricsTicketFunnel", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1MetricsMilestoneFunnelResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.MetricsMilestonesFunnelEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.MetricsMilestonesFunnelEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListUserInvolvements - List user metrics -// Returns a report with time bucketed analytics data -func (s *Metrics) ListUserInvolvements(ctx context.Context, request operations.GetV1MetricsUserInvolvementsRequest, opts ...operations.Option) (*operations.GetV1MetricsUserInvolvementsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1MetricsUserInvolvements", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/metrics/user_involvements") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1MetricsUserInvolvementsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.MetricsMetricsEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.MetricsMetricsEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListIncidentMetrics - List incident metrics -// Returns a report with time bucketed analytics data -func (s *Metrics) ListIncidentMetrics(ctx context.Context, request operations.GetV1MetricsIncidentsRequest, opts ...operations.Option) (*operations.GetV1MetricsIncidentsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1MetricsIncidents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/metrics/incidents") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1MetricsIncidentsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.MetricsMetricsEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.MetricsMetricsEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetMttx - Fetch infrastructure metrics based on custom query -func (s *Metrics) GetMttx(ctx context.Context, request operations.GetV1MetricsMttxRequest, opts ...operations.Option) (*operations.GetV1MetricsMttxResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1MetricsMttx", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/metrics/mttx") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1MetricsMttxResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.MetricsMttxDataEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.MetricsMttxDataEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListByInfraType - List metrics for a component type -// Returns metrics for all components of a given type -func (s *Metrics) ListByInfraType(ctx context.Context, request operations.GetV1MetricsInfraTypeRequest, opts ...operations.Option) (*operations.GetV1MetricsInfraTypeResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1MetricsInfraType", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/metrics/{infra_type}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1MetricsInfraTypeResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.MetricsInfrastructureListEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.MetricsInfrastructureListEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Show metrics for a component -// Return metrics for a specific component -func (s *Metrics) Get(ctx context.Context, request operations.GetV1MetricsInfraTypeInfraIDRequest, opts ...operations.Option) (*operations.GetV1MetricsInfraTypeInfraIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1MetricsInfraTypeInfraId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/metrics/{infra_type}/{infra_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1MetricsInfraTypeInfraIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.MetricsInfrastructureMetricsEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.MetricsInfrastructureMetricsEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/models/errors/sdkerror.go b/internal/sdk/models/errors/sdkerror.go deleted file mode 100644 index c633d56..0000000 --- a/internal/sdk/models/errors/sdkerror.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package errors - -import ( - "fmt" - "net/http" -) - -type SDKError struct { - Message string - StatusCode int - Body string - RawResponse *http.Response -} - -var _ error = &SDKError{} - -func NewSDKError(message string, statusCode int, body string, httpRes *http.Response) *SDKError { - return &SDKError{ - Message: message, - StatusCode: statusCode, - Body: body, - RawResponse: httpRes, - } -} - -func (e *SDKError) Error() string { - body := "" - if len(e.Body) > 0 { - body = fmt.Sprintf("\n%s", e.Body) - } - - return fmt.Sprintf("%s: Status %d%s", e.Message, e.StatusCode, body) -} diff --git a/internal/sdk/models/operations/deletev1changeschangeid.go b/internal/sdk/models/operations/deletev1changeschangeid.go deleted file mode 100644 index 3ee2da8..0000000 --- a/internal/sdk/models/operations/deletev1changeschangeid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1ChangesChangeIDRequest struct { - ChangeID string `pathParam:"style=simple,explode=false,name=change_id"` -} - -func (o *DeleteV1ChangesChangeIDRequest) GetChangeID() string { - if o == nil { - return "" - } - return o.ChangeID -} - -type DeleteV1ChangesChangeIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1ChangesChangeIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ChangesChangeIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ChangesChangeIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1changeschangeididentitiesidentityid.go b/internal/sdk/models/operations/deletev1changeschangeididentitiesidentityid.go deleted file mode 100644 index eb0ad71..0000000 --- a/internal/sdk/models/operations/deletev1changeschangeididentitiesidentityid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1ChangesChangeIDIdentitiesIdentityIDRequest struct { - IdentityID string `pathParam:"style=simple,explode=false,name=identity_id"` - ChangeID string `pathParam:"style=simple,explode=false,name=change_id"` -} - -func (o *DeleteV1ChangesChangeIDIdentitiesIdentityIDRequest) GetIdentityID() string { - if o == nil { - return "" - } - return o.IdentityID -} - -func (o *DeleteV1ChangesChangeIDIdentitiesIdentityIDRequest) GetChangeID() string { - if o == nil { - return "" - } - return o.ChangeID -} - -type DeleteV1ChangesChangeIDIdentitiesIdentityIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *DeleteV1ChangesChangeIDIdentitiesIdentityIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ChangesChangeIDIdentitiesIdentityIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ChangesChangeIDIdentitiesIdentityIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1ChangesChangeIDIdentitiesIdentityIDResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/deletev1changeseventschangeeventid.go b/internal/sdk/models/operations/deletev1changeseventschangeeventid.go deleted file mode 100644 index 9a6cf4b..0000000 --- a/internal/sdk/models/operations/deletev1changeseventschangeeventid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1ChangesEventsChangeEventIDRequest struct { - ChangeEventID string `pathParam:"style=simple,explode=false,name=change_event_id"` -} - -func (o *DeleteV1ChangesEventsChangeEventIDRequest) GetChangeEventID() string { - if o == nil { - return "" - } - return o.ChangeEventID -} - -type DeleteV1ChangesEventsChangeEventIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1ChangesEventsChangeEventIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ChangesEventsChangeEventIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ChangesEventsChangeEventIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1checklisttemplatesid.go b/internal/sdk/models/operations/deletev1checklisttemplatesid.go deleted file mode 100644 index 9d7666b..0000000 --- a/internal/sdk/models/operations/deletev1checklisttemplatesid.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1ChecklistTemplatesIDRequest struct { - // Checklist Template UUID - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1ChecklistTemplatesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1ChecklistTemplatesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Archive a checklist template - ChecklistTemplateEntity *shared.ChecklistTemplateEntity -} - -func (o *DeleteV1ChecklistTemplatesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ChecklistTemplatesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ChecklistTemplatesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1ChecklistTemplatesIDResponse) GetChecklistTemplateEntity() *shared.ChecklistTemplateEntity { - if o == nil { - return nil - } - return o.ChecklistTemplateEntity -} diff --git a/internal/sdk/models/operations/deletev1conversationsconversationidcommentscommentid.go b/internal/sdk/models/operations/deletev1conversationsconversationidcommentscommentid.go deleted file mode 100644 index 41bec35..0000000 --- a/internal/sdk/models/operations/deletev1conversationsconversationidcommentscommentid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1ConversationsConversationIDCommentsCommentIDRequest struct { - CommentID string `pathParam:"style=simple,explode=false,name=comment_id"` - ConversationID string `pathParam:"style=simple,explode=false,name=conversation_id"` -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDRequest) GetCommentID() string { - if o == nil { - return "" - } - return o.CommentID -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDRequest) GetConversationID() string { - if o == nil { - return "" - } - return o.ConversationID -} - -type DeleteV1ConversationsConversationIDCommentsCommentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1conversationsconversationidcommentscommentidreactionsreactionid.go b/internal/sdk/models/operations/deletev1conversationsconversationidcommentscommentidreactionsreactionid.go deleted file mode 100644 index 1ab9b7e..0000000 --- a/internal/sdk/models/operations/deletev1conversationsconversationidcommentscommentidreactionsreactionid.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDRequest struct { - ReactionID string `pathParam:"style=simple,explode=false,name=reaction_id"` - ConversationID string `pathParam:"style=simple,explode=false,name=conversation_id"` - CommentID string `pathParam:"style=simple,explode=false,name=comment_id"` -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDRequest) GetReactionID() string { - if o == nil { - return "" - } - return o.ReactionID -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDRequest) GetConversationID() string { - if o == nil { - return "" - } - return o.ConversationID -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDRequest) GetCommentID() string { - if o == nil { - return "" - } - return o.CommentID -} - -type DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ConversationsConversationIDCommentsCommentIDReactionsReactionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1customfieldsdefinitionsfieldid.go b/internal/sdk/models/operations/deletev1customfieldsdefinitionsfieldid.go deleted file mode 100644 index 370bc07..0000000 --- a/internal/sdk/models/operations/deletev1customfieldsdefinitionsfieldid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1CustomFieldsDefinitionsFieldIDRequest struct { - FieldID string `pathParam:"style=simple,explode=false,name=field_id"` -} - -func (o *DeleteV1CustomFieldsDefinitionsFieldIDRequest) GetFieldID() string { - if o == nil { - return "" - } - return o.FieldID -} - -type DeleteV1CustomFieldsDefinitionsFieldIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a custom field definition - OrganizationsCustomFieldDefinitionEntity *shared.OrganizationsCustomFieldDefinitionEntity -} - -func (o *DeleteV1CustomFieldsDefinitionsFieldIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1CustomFieldsDefinitionsFieldIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1CustomFieldsDefinitionsFieldIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1CustomFieldsDefinitionsFieldIDResponse) GetOrganizationsCustomFieldDefinitionEntity() *shared.OrganizationsCustomFieldDefinitionEntity { - if o == nil { - return nil - } - return o.OrganizationsCustomFieldDefinitionEntity -} diff --git a/internal/sdk/models/operations/deletev1environmentsenvironmentid.go b/internal/sdk/models/operations/deletev1environmentsenvironmentid.go deleted file mode 100644 index a9142c1..0000000 --- a/internal/sdk/models/operations/deletev1environmentsenvironmentid.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1EnvironmentsEnvironmentIDRequest struct { - // Environment UUID - EnvironmentID string `pathParam:"style=simple,explode=false,name=environment_id"` -} - -func (o *DeleteV1EnvironmentsEnvironmentIDRequest) GetEnvironmentID() string { - if o == nil { - return "" - } - return o.EnvironmentID -} - -type DeleteV1EnvironmentsEnvironmentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Archive an environment - EnvironmentEntryEntity *shared.EnvironmentEntryEntity -} - -func (o *DeleteV1EnvironmentsEnvironmentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1EnvironmentsEnvironmentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1EnvironmentsEnvironmentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1EnvironmentsEnvironmentIDResponse) GetEnvironmentEntryEntity() *shared.EnvironmentEntryEntity { - if o == nil { - return nil - } - return o.EnvironmentEntryEntity -} diff --git a/internal/sdk/models/operations/deletev1functionalitiesfunctionalityid.go b/internal/sdk/models/operations/deletev1functionalitiesfunctionalityid.go deleted file mode 100644 index 86911fa..0000000 --- a/internal/sdk/models/operations/deletev1functionalitiesfunctionalityid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1FunctionalitiesFunctionalityIDRequest struct { - FunctionalityID string `pathParam:"style=simple,explode=false,name=functionality_id"` -} - -func (o *DeleteV1FunctionalitiesFunctionalityIDRequest) GetFunctionalityID() string { - if o == nil { - return "" - } - return o.FunctionalityID -} - -type DeleteV1FunctionalitiesFunctionalityIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Archive a functionality - FunctionalityEntity *shared.FunctionalityEntity -} - -func (o *DeleteV1FunctionalitiesFunctionalityIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1FunctionalitiesFunctionalityIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1FunctionalitiesFunctionalityIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1FunctionalitiesFunctionalityIDResponse) GetFunctionalityEntity() *shared.FunctionalityEntity { - if o == nil { - return nil - } - return o.FunctionalityEntity -} diff --git a/internal/sdk/models/operations/deletev1incidentrolesincidentroleid.go b/internal/sdk/models/operations/deletev1incidentrolesincidentroleid.go deleted file mode 100644 index aea708d..0000000 --- a/internal/sdk/models/operations/deletev1incidentrolesincidentroleid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1IncidentRolesIncidentRoleIDRequest struct { - IncidentRoleID string `pathParam:"style=simple,explode=false,name=incident_role_id"` -} - -func (o *DeleteV1IncidentRolesIncidentRoleIDRequest) GetIncidentRoleID() string { - if o == nil { - return "" - } - return o.IncidentRoleID -} - -type DeleteV1IncidentRolesIncidentRoleIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Archives an incident role which will hide it from lists and metrics - IncidentRoleEntity *shared.IncidentRoleEntity -} - -func (o *DeleteV1IncidentRolesIncidentRoleIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentRolesIncidentRoleIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentRolesIncidentRoleIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1IncidentRolesIncidentRoleIDResponse) GetIncidentRoleEntity() *shared.IncidentRoleEntity { - if o == nil { - return nil - } - return o.IncidentRoleEntity -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentid.go b/internal/sdk/models/operations/deletev1incidentsincidentid.go deleted file mode 100644 index 5a07f5f..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1IncidentsIncidentIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *DeleteV1IncidentsIncidentIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type DeleteV1IncidentsIncidentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Archives an incident which will hide it from lists and metrics - IncidentEntity *shared.IncidentEntity -} - -func (o *DeleteV1IncidentsIncidentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1IncidentsIncidentIDResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidalertsincidentalertid.go b/internal/sdk/models/operations/deletev1incidentsincidentidalertsincidentalertid.go deleted file mode 100644 index 62dc456..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidalertsincidentalertid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDRequest struct { - IncidentAlertID string `pathParam:"style=simple,explode=false,name=incident_alert_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDRequest) GetIncidentAlertID() string { - if o == nil { - return "" - } - return o.IncidentAlertID -} - -func (o *DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDAlertsIncidentAlertIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentideventseventid.go b/internal/sdk/models/operations/deletev1incidentsincidentideventseventid.go deleted file mode 100644 index 315a487..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentideventseventid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1IncidentsIncidentIDEventsEventIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - EventID string `pathParam:"style=simple,explode=false,name=event_id"` -} - -func (o *DeleteV1IncidentsIncidentIDEventsEventIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *DeleteV1IncidentsIncidentIDEventsEventIDRequest) GetEventID() string { - if o == nil { - return "" - } - return o.EventID -} - -type DeleteV1IncidentsIncidentIDEventsEventIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a single event for an incident - IncidentEventEntity *shared.IncidentEventEntity -} - -func (o *DeleteV1IncidentsIncidentIDEventsEventIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDEventsEventIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDEventsEventIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1IncidentsIncidentIDEventsEventIDResponse) GetIncidentEventEntity() *shared.IncidentEventEntity { - if o == nil { - return nil - } - return o.IncidentEventEntity -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidgenericchatmessagesmessageid.go b/internal/sdk/models/operations/deletev1incidentsincidentidgenericchatmessagesmessageid.go deleted file mode 100644 index 7bc6301..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidgenericchatmessagesmessageid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest struct { - MessageID string `pathParam:"style=simple,explode=false,name=message_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest) GetMessageID() string { - if o == nil { - return "" - } - return o.MessageID -} - -func (o *DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete an existing generic chat message on an incident. - EventGenericChatMessageEntity *shared.EventGenericChatMessageEntity -} - -func (o *DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse) GetEventGenericChatMessageEntity() *shared.EventGenericChatMessageEntity { - if o == nil { - return nil - } - return o.EventGenericChatMessageEntity -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidimpacttypeid.go b/internal/sdk/models/operations/deletev1incidentsincidentidimpacttypeid.go deleted file mode 100644 index f00a609..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidimpacttypeid.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType string - -const ( - DeleteV1IncidentsIncidentIDImpactTypeIDPathParamTypeEnvironments DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType = "environments" - DeleteV1IncidentsIncidentIDImpactTypeIDPathParamTypeFunctionalities DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType = "functionalities" - DeleteV1IncidentsIncidentIDImpactTypeIDPathParamTypeServices DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType = "services" - DeleteV1IncidentsIncidentIDImpactTypeIDPathParamTypeCustomers DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType = "customers" -) - -func (e DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType) ToPointer() *DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType { - return &e -} -func (e *DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "environments": - fallthrough - case "functionalities": - fallthrough - case "services": - fallthrough - case "customers": - *e = DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType(v) - return nil - default: - return fmt.Errorf("invalid value for DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType: %v", v) - } -} - -type DeleteV1IncidentsIncidentIDImpactTypeIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - Type DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType `pathParam:"style=simple,explode=false,name=type"` - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1IncidentsIncidentIDImpactTypeIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *DeleteV1IncidentsIncidentIDImpactTypeIDRequest) GetType() DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType { - if o == nil { - return DeleteV1IncidentsIncidentIDImpactTypeIDPathParamType("") - } - return o.Type -} - -func (o *DeleteV1IncidentsIncidentIDImpactTypeIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1IncidentsIncidentIDImpactTypeIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *DeleteV1IncidentsIncidentIDImpactTypeIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDImpactTypeIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDImpactTypeIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1IncidentsIncidentIDImpactTypeIDResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidlinkslinkid.go b/internal/sdk/models/operations/deletev1incidentsincidentidlinkslinkid.go deleted file mode 100644 index 3162141..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidlinkslinkid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1IncidentsIncidentIDLinksLinkIDRequest struct { - LinkID string `pathParam:"style=simple,explode=false,name=link_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *DeleteV1IncidentsIncidentIDLinksLinkIDRequest) GetLinkID() string { - if o == nil { - return "" - } - return o.LinkID -} - -func (o *DeleteV1IncidentsIncidentIDLinksLinkIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type DeleteV1IncidentsIncidentIDLinksLinkIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1IncidentsIncidentIDLinksLinkIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDLinksLinkIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDLinksLinkIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidroleassignmentsroleassignmentid.go b/internal/sdk/models/operations/deletev1incidentsincidentidroleassignmentsroleassignmentid.go deleted file mode 100644 index 76e018a..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidroleassignmentsroleassignmentid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - RoleAssignmentID string `pathParam:"style=simple,explode=false,name=role_assignment_id"` -} - -func (o *DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDRequest) GetRoleAssignmentID() string { - if o == nil { - return "" - } - return o.RoleAssignmentID -} - -type DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Unassign a role from a user - IncidentsRoleAssignmentEntity *shared.IncidentsRoleAssignmentEntity -} - -func (o *DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDResponse) GetIncidentsRoleAssignmentEntity() *shared.IncidentsRoleAssignmentEntity { - if o == nil { - return nil - } - return o.IncidentsRoleAssignmentEntity -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidstatuspagesstatuspageid.go b/internal/sdk/models/operations/deletev1incidentsincidentidstatuspagesstatuspageid.go deleted file mode 100644 index 7098521..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidstatuspagesstatuspageid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDRequest struct { - StatusPageID string `pathParam:"style=simple,explode=false,name=status_page_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDRequest) GetStatusPageID() string { - if o == nil { - return "" - } - return o.StatusPageID -} - -func (o *DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDStatusPagesStatusPageIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidtaskstaskid.go b/internal/sdk/models/operations/deletev1incidentsincidentidtaskstaskid.go deleted file mode 100644 index 211c4d8..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidtaskstaskid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1IncidentsIncidentIDTasksTaskIDRequest struct { - TaskID string `pathParam:"style=simple,explode=false,name=task_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *DeleteV1IncidentsIncidentIDTasksTaskIDRequest) GetTaskID() string { - if o == nil { - return "" - } - return o.TaskID -} - -func (o *DeleteV1IncidentsIncidentIDTasksTaskIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type DeleteV1IncidentsIncidentIDTasksTaskIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1IncidentsIncidentIDTasksTaskIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDTasksTaskIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDTasksTaskIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidteamassignmentsteamassignmentid.go b/internal/sdk/models/operations/deletev1incidentsincidentidteamassignmentsteamassignmentid.go deleted file mode 100644 index f8a24ed..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidteamassignmentsteamassignmentid.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequestBody struct { - // Team role assignments to unassign from the incident - RoleAssignmentIds []string `form:"name=role_assignment_ids"` -} - -func (o *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequestBody) GetRoleAssignmentIds() []string { - if o == nil { - return nil - } - return o.RoleAssignmentIds -} - -type DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - TeamAssignmentID string `pathParam:"style=simple,explode=false,name=team_assignment_id"` - RequestBody *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequest) GetTeamAssignmentID() string { - if o == nil { - return "" - } - return o.TeamAssignmentID -} - -func (o *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequest) GetRequestBody() *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDTeamAssignmentsTeamAssignmentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1incidentsincidentidtranscripttranscriptid.go b/internal/sdk/models/operations/deletev1incidentsincidentidtranscripttranscriptid.go deleted file mode 100644 index 5d0fa9e..0000000 --- a/internal/sdk/models/operations/deletev1incidentsincidentidtranscripttranscriptid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1IncidentsIncidentIDTranscriptTranscriptIDRequest struct { - TranscriptID string `pathParam:"style=simple,explode=false,name=transcript_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *DeleteV1IncidentsIncidentIDTranscriptTranscriptIDRequest) GetTranscriptID() string { - if o == nil { - return "" - } - return o.TranscriptID -} - -func (o *DeleteV1IncidentsIncidentIDTranscriptTranscriptIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type DeleteV1IncidentsIncidentIDTranscriptTranscriptIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1IncidentsIncidentIDTranscriptTranscriptIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentsIncidentIDTranscriptTranscriptIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentsIncidentIDTranscriptTranscriptIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1incidenttypesid.go b/internal/sdk/models/operations/deletev1incidenttypesid.go deleted file mode 100644 index 6230673..0000000 --- a/internal/sdk/models/operations/deletev1incidenttypesid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1IncidentTypesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1IncidentTypesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1IncidentTypesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Archives an incident type which will hide it from lists and metrics - IncidentTypeEntity *shared.IncidentTypeEntity -} - -func (o *DeleteV1IncidentTypesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IncidentTypesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IncidentTypesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1IncidentTypesIDResponse) GetIncidentTypeEntity() *shared.IncidentTypeEntity { - if o == nil { - return nil - } - return o.IncidentTypeEntity -} diff --git a/internal/sdk/models/operations/deletev1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go b/internal/sdk/models/operations/deletev1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go deleted file mode 100644 index 577102c..0000000 --- a/internal/sdk/models/operations/deletev1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest struct { - // Slack Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` - EmojiActionID string `pathParam:"style=simple,explode=false,name=emoji_action_id"` -} - -func (o *DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -func (o *DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest) GetEmojiActionID() string { - if o == nil { - return "" - } - return o.EmojiActionID -} - -type DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1integrationsstatuspageconnectionsconnectionid.go b/internal/sdk/models/operations/deletev1integrationsstatuspageconnectionsconnectionid.go deleted file mode 100644 index 7b61a3b..0000000 --- a/internal/sdk/models/operations/deletev1integrationsstatuspageconnectionsconnectionid.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1IntegrationsStatuspageConnectionsConnectionIDRequest struct { - // Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` -} - -func (o *DeleteV1IntegrationsStatuspageConnectionsConnectionIDRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -type DeleteV1IntegrationsStatuspageConnectionsConnectionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Deletes the given Statuspage integration connection. - IntegrationsStatuspageConnectionEntity *shared.IntegrationsStatuspageConnectionEntity -} - -func (o *DeleteV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetIntegrationsStatuspageConnectionEntity() *shared.IntegrationsStatuspageConnectionEntity { - if o == nil { - return nil - } - return o.IntegrationsStatuspageConnectionEntity -} diff --git a/internal/sdk/models/operations/deletev1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go b/internal/sdk/models/operations/deletev1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go deleted file mode 100644 index 4a6eadd..0000000 --- a/internal/sdk/models/operations/deletev1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest struct { - MeasurementDefinitionID string `pathParam:"style=simple,explode=false,name=measurement_definition_id"` -} - -func (o *DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest) GetMeasurementDefinitionID() string { - if o == nil { - return "" - } - return o.MeasurementDefinitionID -} - -type DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1lifecyclesmilestonesmilestoneid.go b/internal/sdk/models/operations/deletev1lifecyclesmilestonesmilestoneid.go deleted file mode 100644 index 771efef..0000000 --- a/internal/sdk/models/operations/deletev1lifecyclesmilestonesmilestoneid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1LifecyclesMilestonesMilestoneIDRequest struct { - MilestoneID string `pathParam:"style=simple,explode=false,name=milestone_id"` -} - -func (o *DeleteV1LifecyclesMilestonesMilestoneIDRequest) GetMilestoneID() string { - if o == nil { - return "" - } - return o.MilestoneID -} - -type DeleteV1LifecyclesMilestonesMilestoneIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a milestone - LifecyclesPhaseEntity *shared.LifecyclesPhaseEntity -} - -func (o *DeleteV1LifecyclesMilestonesMilestoneIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1LifecyclesMilestonesMilestoneIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1LifecyclesMilestonesMilestoneIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1LifecyclesMilestonesMilestoneIDResponse) GetLifecyclesPhaseEntity() *shared.LifecyclesPhaseEntity { - if o == nil { - return nil - } - return o.LifecyclesPhaseEntity -} diff --git a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionid.go b/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionid.go deleted file mode 100644 index 8121f80..0000000 --- a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1NuncConnectionsNuncConnectionIDRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -type DeleteV1NuncConnectionsNuncConnectionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a FireHydrant hosted status page, stopping updates of your incidents to it. - NuncConnectionEntity *shared.NuncConnectionEntity -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDResponse) GetNuncConnectionEntity() *shared.NuncConnectionEntity { - if o == nil { - return nil - } - return o.NuncConnectionEntity -} diff --git a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidcomponentgroupsgroupid.go b/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidcomponentgroupsgroupid.go deleted file mode 100644 index 4794ce3..0000000 --- a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidcomponentgroupsgroupid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - GroupID string `pathParam:"style=simple,explode=false,name=group_id"` -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest) GetGroupID() string { - if o == nil { - return "" - } - return o.GroupID -} - -type DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidimagestype.go b/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidimagestype.go deleted file mode 100644 index 981c58f..0000000 --- a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidimagestype.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1NuncConnectionsNuncConnectionIDImagesTypeRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - Type string `pathParam:"style=simple,explode=false,name=type"` -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDImagesTypeRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDImagesTypeRequest) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -type DeleteV1NuncConnectionsNuncConnectionIDImagesTypeResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete an image attached to a FireHydrant status page - NuncConnectionEntity *shared.NuncConnectionEntity -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDImagesTypeResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDImagesTypeResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDImagesTypeResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDImagesTypeResponse) GetNuncConnectionEntity() *shared.NuncConnectionEntity { - if o == nil { - return nil - } - return o.NuncConnectionEntity -} diff --git a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidlinkslinkid.go b/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidlinkslinkid.go deleted file mode 100644 index 3334c54..0000000 --- a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidlinkslinkid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - LinkID string `pathParam:"style=simple,explode=false,name=link_id"` -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest) GetLinkID() string { - if o == nil { - return "" - } - return o.LinkID -} - -type DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidsubscribers.go b/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidsubscribers.go deleted file mode 100644 index ae639f6..0000000 --- a/internal/sdk/models/operations/deletev1nuncconnectionsnuncconnectionidsubscribers.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1NuncConnectionsNuncConnectionIDSubscribersRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - // A list of subscriber IDs to unsubscribe. - SubscriberIds string `queryParam:"style=form,explode=true,name=subscriber_ids"` -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDSubscribersRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDSubscribersRequest) GetSubscriberIds() string { - if o == nil { - return "" - } - return o.SubscriberIds -} - -type DeleteV1NuncConnectionsNuncConnectionIDSubscribersResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Unsubscribes one or more status page subscribers. - NuncEmailSubscribersEntity *shared.NuncEmailSubscribersEntity -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetNuncEmailSubscribersEntity() *shared.NuncEmailSubscribersEntity { - if o == nil { - return nil - } - return o.NuncEmailSubscribersEntity -} diff --git a/internal/sdk/models/operations/deletev1nuncsubscriptionsunsubscribetoken.go b/internal/sdk/models/operations/deletev1nuncsubscriptionsunsubscribetoken.go deleted file mode 100644 index e3bfe6d..0000000 --- a/internal/sdk/models/operations/deletev1nuncsubscriptionsunsubscribetoken.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1NuncSubscriptionsUnsubscribeTokenRequest struct { - UnsubscribeToken string `pathParam:"style=simple,explode=false,name=unsubscribe_token"` -} - -func (o *DeleteV1NuncSubscriptionsUnsubscribeTokenRequest) GetUnsubscribeToken() string { - if o == nil { - return "" - } - return o.UnsubscribeToken -} - -type DeleteV1NuncSubscriptionsUnsubscribeTokenResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Unsubscribe from status page updates - NuncNuncSubscription *shared.NuncNuncSubscription -} - -func (o *DeleteV1NuncSubscriptionsUnsubscribeTokenResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1NuncSubscriptionsUnsubscribeTokenResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1NuncSubscriptionsUnsubscribeTokenResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1NuncSubscriptionsUnsubscribeTokenResponse) GetNuncNuncSubscription() *shared.NuncNuncSubscription { - if o == nil { - return nil - } - return o.NuncNuncSubscription -} diff --git a/internal/sdk/models/operations/deletev1postmortemsreportsreportidreasonsreasonid.go b/internal/sdk/models/operations/deletev1postmortemsreportsreportidreasonsreasonid.go deleted file mode 100644 index 953518a..0000000 --- a/internal/sdk/models/operations/deletev1postmortemsreportsreportidreasonsreasonid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1PostMortemsReportsReportIDReasonsReasonIDRequest struct { - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` - ReasonID string `pathParam:"style=simple,explode=false,name=reason_id"` -} - -func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDRequest) GetReasonID() string { - if o == nil { - return "" - } - return o.ReasonID -} - -type DeleteV1PostMortemsReportsReportIDReasonsReasonIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a contributing factor - PostMortemsReasonEntity *shared.PostMortemsReasonEntity -} - -func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDResponse) GetPostMortemsReasonEntity() *shared.PostMortemsReasonEntity { - if o == nil { - return nil - } - return o.PostMortemsReasonEntity -} diff --git a/internal/sdk/models/operations/deletev1prioritiespriorityslug.go b/internal/sdk/models/operations/deletev1prioritiespriorityslug.go deleted file mode 100644 index d35429a..0000000 --- a/internal/sdk/models/operations/deletev1prioritiespriorityslug.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1PrioritiesPrioritySlugRequest struct { - PrioritySlug string `pathParam:"style=simple,explode=false,name=priority_slug"` -} - -func (o *DeleteV1PrioritiesPrioritySlugRequest) GetPrioritySlug() string { - if o == nil { - return "" - } - return o.PrioritySlug -} - -type DeleteV1PrioritiesPrioritySlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a specific priority - PriorityEntity *shared.PriorityEntity -} - -func (o *DeleteV1PrioritiesPrioritySlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1PrioritiesPrioritySlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1PrioritiesPrioritySlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1PrioritiesPrioritySlugResponse) GetPriorityEntity() *shared.PriorityEntity { - if o == nil { - return nil - } - return o.PriorityEntity -} diff --git a/internal/sdk/models/operations/deletev1runbooksexecutionsexecutionid.go b/internal/sdk/models/operations/deletev1runbooksexecutionsexecutionid.go deleted file mode 100644 index 0261168..0000000 --- a/internal/sdk/models/operations/deletev1runbooksexecutionsexecutionid.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1RunbooksExecutionsExecutionIDRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` - // The reason for terminating the runbook execution - Reason string `queryParam:"style=form,explode=true,name=reason"` -} - -func (o *DeleteV1RunbooksExecutionsExecutionIDRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -func (o *DeleteV1RunbooksExecutionsExecutionIDRequest) GetReason() string { - if o == nil { - return "" - } - return o.Reason -} - -type DeleteV1RunbooksExecutionsExecutionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1RunbooksExecutionsExecutionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1RunbooksExecutionsExecutionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1RunbooksExecutionsExecutionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1runbooksrunbookid.go b/internal/sdk/models/operations/deletev1runbooksrunbookid.go deleted file mode 100644 index aa2c809..0000000 --- a/internal/sdk/models/operations/deletev1runbooksrunbookid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1RunbooksRunbookIDRequest struct { - RunbookID string `pathParam:"style=simple,explode=false,name=runbook_id"` -} - -func (o *DeleteV1RunbooksRunbookIDRequest) GetRunbookID() string { - if o == nil { - return "" - } - return o.RunbookID -} - -type DeleteV1RunbooksRunbookIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a runbook and make it unavailable for any future incidents. - RunbookEntity *shared.RunbookEntity -} - -func (o *DeleteV1RunbooksRunbookIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1RunbooksRunbookIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1RunbooksRunbookIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1RunbooksRunbookIDResponse) GetRunbookEntity() *shared.RunbookEntity { - if o == nil { - return nil - } - return o.RunbookEntity -} diff --git a/internal/sdk/models/operations/deletev1savedsearchesresourcetypesavedsearchid.go b/internal/sdk/models/operations/deletev1savedsearchesresourcetypesavedsearchid.go deleted file mode 100644 index c81472b..0000000 --- a/internal/sdk/models/operations/deletev1savedsearchesresourcetypesavedsearchid.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "net/http" -) - -type ResourceType string - -const ( - ResourceTypeChangeEvents ResourceType = "change_events" - ResourceTypeIncidents ResourceType = "incidents" - ResourceTypeServices ResourceType = "services" - ResourceTypeScheduledMaintenances ResourceType = "scheduled_maintenances" - ResourceTypeTicketTasks ResourceType = "ticket_tasks" - ResourceTypeTicketFollowUps ResourceType = "ticket_follow_ups" - ResourceTypeAnalytics ResourceType = "analytics" - ResourceTypeImpactAnalytics ResourceType = "impact_analytics" - ResourceTypeAlerts ResourceType = "alerts" - ResourceTypeIncidentEvents ResourceType = "incident_events" -) - -func (e ResourceType) ToPointer() *ResourceType { - return &e -} -func (e *ResourceType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "change_events": - fallthrough - case "incidents": - fallthrough - case "services": - fallthrough - case "scheduled_maintenances": - fallthrough - case "ticket_tasks": - fallthrough - case "ticket_follow_ups": - fallthrough - case "analytics": - fallthrough - case "impact_analytics": - fallthrough - case "alerts": - fallthrough - case "incident_events": - *e = ResourceType(v) - return nil - default: - return fmt.Errorf("invalid value for ResourceType: %v", v) - } -} - -type DeleteV1SavedSearchesResourceTypeSavedSearchIDRequest struct { - ResourceType ResourceType `pathParam:"style=simple,explode=false,name=resource_type"` - SavedSearchID string `pathParam:"style=simple,explode=false,name=saved_search_id"` -} - -func (o *DeleteV1SavedSearchesResourceTypeSavedSearchIDRequest) GetResourceType() ResourceType { - if o == nil { - return ResourceType("") - } - return o.ResourceType -} - -func (o *DeleteV1SavedSearchesResourceTypeSavedSearchIDRequest) GetSavedSearchID() string { - if o == nil { - return "" - } - return o.SavedSearchID -} - -type DeleteV1SavedSearchesResourceTypeSavedSearchIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1SavedSearchesResourceTypeSavedSearchIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1SavedSearchesResourceTypeSavedSearchIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1SavedSearchesResourceTypeSavedSearchIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1scheduledmaintenancesscheduledmaintenanceid.go b/internal/sdk/models/operations/deletev1scheduledmaintenancesscheduledmaintenanceid.go deleted file mode 100644 index 1ddc9a5..0000000 --- a/internal/sdk/models/operations/deletev1scheduledmaintenancesscheduledmaintenanceid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1ScheduledMaintenancesScheduledMaintenanceIDRequest struct { - ScheduledMaintenanceID string `pathParam:"style=simple,explode=false,name=scheduled_maintenance_id"` -} - -func (o *DeleteV1ScheduledMaintenancesScheduledMaintenanceIDRequest) GetScheduledMaintenanceID() string { - if o == nil { - return "" - } - return o.ScheduledMaintenanceID -} - -type DeleteV1ScheduledMaintenancesScheduledMaintenanceIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1scimv2groupsid.go b/internal/sdk/models/operations/deletev1scimv2groupsid.go deleted file mode 100644 index 736290e..0000000 --- a/internal/sdk/models/operations/deletev1scimv2groupsid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1ScimV2GroupsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1ScimV2GroupsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1ScimV2GroupsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1ScimV2GroupsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ScimV2GroupsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ScimV2GroupsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1scimv2usersid.go b/internal/sdk/models/operations/deletev1scimv2usersid.go deleted file mode 100644 index 53c120e..0000000 --- a/internal/sdk/models/operations/deletev1scimv2usersid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1ScimV2UsersIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1ScimV2UsersIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1ScimV2UsersIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1ScimV2UsersIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ScimV2UsersIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ScimV2UsersIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1servicedependenciesservicedependencyid.go b/internal/sdk/models/operations/deletev1servicedependenciesservicedependencyid.go deleted file mode 100644 index 4edb97e..0000000 --- a/internal/sdk/models/operations/deletev1servicedependenciesservicedependencyid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1ServiceDependenciesServiceDependencyIDRequest struct { - ServiceDependencyID string `pathParam:"style=simple,explode=false,name=service_dependency_id"` -} - -func (o *DeleteV1ServiceDependenciesServiceDependencyIDRequest) GetServiceDependencyID() string { - if o == nil { - return "" - } - return o.ServiceDependencyID -} - -type DeleteV1ServiceDependenciesServiceDependencyIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Deletes a single service dependency - ServiceDependencyEntity *shared.ServiceDependencyEntity -} - -func (o *DeleteV1ServiceDependenciesServiceDependencyIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ServiceDependenciesServiceDependencyIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ServiceDependenciesServiceDependencyIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1ServiceDependenciesServiceDependencyIDResponse) GetServiceDependencyEntity() *shared.ServiceDependencyEntity { - if o == nil { - return nil - } - return o.ServiceDependencyEntity -} diff --git a/internal/sdk/models/operations/deletev1servicesserviceid.go b/internal/sdk/models/operations/deletev1servicesserviceid.go deleted file mode 100644 index c1352dd..0000000 --- a/internal/sdk/models/operations/deletev1servicesserviceid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1ServicesServiceIDRequest struct { - ServiceID string `pathParam:"style=simple,explode=false,name=service_id"` -} - -func (o *DeleteV1ServicesServiceIDRequest) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -type DeleteV1ServicesServiceIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Deletes the service from FireHydrant. - ServiceEntity *shared.ServiceEntity -} - -func (o *DeleteV1ServicesServiceIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ServicesServiceIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ServicesServiceIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1ServicesServiceIDResponse) GetServiceEntity() *shared.ServiceEntity { - if o == nil { - return nil - } - return o.ServiceEntity -} diff --git a/internal/sdk/models/operations/deletev1servicesserviceidservicelinksremoteid.go b/internal/sdk/models/operations/deletev1servicesserviceidservicelinksremoteid.go deleted file mode 100644 index 543fcd5..0000000 --- a/internal/sdk/models/operations/deletev1servicesserviceidservicelinksremoteid.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1ServicesServiceIDServiceLinksRemoteIDRequest struct { - ServiceID string `pathParam:"style=simple,explode=false,name=service_id"` - // The external service ID which can be found in the JSON - // from GET services/:service_id endpoint under - // functionalities > external_resources > remote_id - // - RemoteID string `pathParam:"style=simple,explode=false,name=remote_id"` -} - -func (o *DeleteV1ServicesServiceIDServiceLinksRemoteIDRequest) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -func (o *DeleteV1ServicesServiceIDServiceLinksRemoteIDRequest) GetRemoteID() string { - if o == nil { - return "" - } - return o.RemoteID -} - -type DeleteV1ServicesServiceIDServiceLinksRemoteIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1ServicesServiceIDServiceLinksRemoteIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1ServicesServiceIDServiceLinksRemoteIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1ServicesServiceIDServiceLinksRemoteIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1severitiesseverityslug.go b/internal/sdk/models/operations/deletev1severitiesseverityslug.go deleted file mode 100644 index 756e6d8..0000000 --- a/internal/sdk/models/operations/deletev1severitiesseverityslug.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1SeveritiesSeveritySlugRequest struct { - SeveritySlug string `pathParam:"style=simple,explode=false,name=severity_slug"` -} - -func (o *DeleteV1SeveritiesSeveritySlugRequest) GetSeveritySlug() string { - if o == nil { - return "" - } - return o.SeveritySlug -} - -type DeleteV1SeveritiesSeveritySlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a specific severity - SeverityEntity *shared.SeverityEntity -} - -func (o *DeleteV1SeveritiesSeveritySlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1SeveritiesSeveritySlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1SeveritiesSeveritySlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1SeveritiesSeveritySlugResponse) GetSeverityEntity() *shared.SeverityEntity { - if o == nil { - return nil - } - return o.SeverityEntity -} diff --git a/internal/sdk/models/operations/deletev1severitymatrixconditionsconditionid.go b/internal/sdk/models/operations/deletev1severitymatrixconditionsconditionid.go deleted file mode 100644 index 093d933..0000000 --- a/internal/sdk/models/operations/deletev1severitymatrixconditionsconditionid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1SeverityMatrixConditionsConditionIDRequest struct { - ConditionID string `pathParam:"style=simple,explode=false,name=condition_id"` -} - -func (o *DeleteV1SeverityMatrixConditionsConditionIDRequest) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -type DeleteV1SeverityMatrixConditionsConditionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a specific condition - SeverityMatrixConditionEntity *shared.SeverityMatrixConditionEntity -} - -func (o *DeleteV1SeverityMatrixConditionsConditionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1SeverityMatrixConditionsConditionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1SeverityMatrixConditionsConditionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1SeverityMatrixConditionsConditionIDResponse) GetSeverityMatrixConditionEntity() *shared.SeverityMatrixConditionEntity { - if o == nil { - return nil - } - return o.SeverityMatrixConditionEntity -} diff --git a/internal/sdk/models/operations/deletev1severitymatriximpactsimpactid.go b/internal/sdk/models/operations/deletev1severitymatriximpactsimpactid.go deleted file mode 100644 index 62ea34d..0000000 --- a/internal/sdk/models/operations/deletev1severitymatriximpactsimpactid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1SeverityMatrixImpactsImpactIDRequest struct { - ImpactID string `pathParam:"style=simple,explode=false,name=impact_id"` -} - -func (o *DeleteV1SeverityMatrixImpactsImpactIDRequest) GetImpactID() string { - if o == nil { - return "" - } - return o.ImpactID -} - -type DeleteV1SeverityMatrixImpactsImpactIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a specific impact - SeverityMatrixImpactEntity *shared.SeverityMatrixImpactEntity -} - -func (o *DeleteV1SeverityMatrixImpactsImpactIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1SeverityMatrixImpactsImpactIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1SeverityMatrixImpactsImpactIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1SeverityMatrixImpactsImpactIDResponse) GetSeverityMatrixImpactEntity() *shared.SeverityMatrixImpactEntity { - if o == nil { - return nil - } - return o.SeverityMatrixImpactEntity -} diff --git a/internal/sdk/models/operations/deletev1signalsemailtargetsid.go b/internal/sdk/models/operations/deletev1signalsemailtargetsid.go deleted file mode 100644 index 75035bd..0000000 --- a/internal/sdk/models/operations/deletev1signalsemailtargetsid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1SignalsEmailTargetsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1SignalsEmailTargetsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1SignalsEmailTargetsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1SignalsEmailTargetsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1SignalsEmailTargetsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1SignalsEmailTargetsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1signalswebhooktargetsid.go b/internal/sdk/models/operations/deletev1signalswebhooktargetsid.go deleted file mode 100644 index 4a98c37..0000000 --- a/internal/sdk/models/operations/deletev1signalswebhooktargetsid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1SignalsWebhookTargetsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1SignalsWebhookTargetsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1SignalsWebhookTargetsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1SignalsWebhookTargetsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1SignalsWebhookTargetsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1SignalsWebhookTargetsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1statusupdatetemplatesstatusupdatetemplateid.go b/internal/sdk/models/operations/deletev1statusupdatetemplatesstatusupdatetemplateid.go deleted file mode 100644 index a18a0bf..0000000 --- a/internal/sdk/models/operations/deletev1statusupdatetemplatesstatusupdatetemplateid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest struct { - StatusUpdateTemplateID string `pathParam:"style=simple,explode=false,name=status_update_template_id"` -} - -func (o *DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest) GetStatusUpdateTemplateID() string { - if o == nil { - return "" - } - return o.StatusUpdateTemplateID -} - -type DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a single status update template - StatusUpdateTemplateEntity *shared.StatusUpdateTemplateEntity -} - -func (o *DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetStatusUpdateTemplateEntity() *shared.StatusUpdateTemplateEntity { - if o == nil { - return nil - } - return o.StatusUpdateTemplateEntity -} diff --git a/internal/sdk/models/operations/deletev1taskliststasklistid.go b/internal/sdk/models/operations/deletev1taskliststasklistid.go deleted file mode 100644 index d51bf2d..0000000 --- a/internal/sdk/models/operations/deletev1taskliststasklistid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1TaskListsTaskListIDRequest struct { - TaskListID string `pathParam:"style=simple,explode=false,name=task_list_id"` -} - -func (o *DeleteV1TaskListsTaskListIDRequest) GetTaskListID() string { - if o == nil { - return "" - } - return o.TaskListID -} - -type DeleteV1TaskListsTaskListIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a task list - TaskListEntity *shared.TaskListEntity -} - -func (o *DeleteV1TaskListsTaskListIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TaskListsTaskListIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TaskListsTaskListIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1TaskListsTaskListIDResponse) GetTaskListEntity() *shared.TaskListEntity { - if o == nil { - return nil - } - return o.TaskListEntity -} diff --git a/internal/sdk/models/operations/deletev1teamsteamid.go b/internal/sdk/models/operations/deletev1teamsteamid.go deleted file mode 100644 index 235ee82..0000000 --- a/internal/sdk/models/operations/deletev1teamsteamid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1TeamsTeamIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` -} - -func (o *DeleteV1TeamsTeamIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -type DeleteV1TeamsTeamIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Archives an team which will hide it from lists and metrics - TeamEntity *shared.TeamEntity -} - -func (o *DeleteV1TeamsTeamIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TeamsTeamIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TeamsTeamIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1TeamsTeamIDResponse) GetTeamEntity() *shared.TeamEntity { - if o == nil { - return nil - } - return o.TeamEntity -} diff --git a/internal/sdk/models/operations/deletev1teamsteamidescalationpoliciesid.go b/internal/sdk/models/operations/deletev1teamsteamidescalationpoliciesid.go deleted file mode 100644 index 09f937f..0000000 --- a/internal/sdk/models/operations/deletev1teamsteamidescalationpoliciesid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1TeamsTeamIDEscalationPoliciesIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1TeamsTeamIDEscalationPoliciesIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *DeleteV1TeamsTeamIDEscalationPoliciesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1TeamsTeamIDEscalationPoliciesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1TeamsTeamIDEscalationPoliciesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TeamsTeamIDEscalationPoliciesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TeamsTeamIDEscalationPoliciesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1teamsteamidoncallschedulesscheduleid.go b/internal/sdk/models/operations/deletev1teamsteamidoncallschedulesscheduleid.go deleted file mode 100644 index 5ee6b05..0000000 --- a/internal/sdk/models/operations/deletev1teamsteamidoncallschedulesscheduleid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ScheduleID string `pathParam:"style=simple,explode=false,name=schedule_id"` -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDRequest) GetScheduleID() string { - if o == nil { - return "" - } - return o.ScheduleID -} - -type DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1teamsteamidoncallschedulesscheduleidshiftsid.go b/internal/sdk/models/operations/deletev1teamsteamidoncallschedulesscheduleidshiftsid.go deleted file mode 100644 index b84e464..0000000 --- a/internal/sdk/models/operations/deletev1teamsteamidoncallschedulesscheduleidshiftsid.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ScheduleID string `pathParam:"style=simple,explode=false,name=schedule_id"` -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetScheduleID() string { - if o == nil { - return "" - } - return o.ScheduleID -} - -type DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1teamsteamidsignalrulesid.go b/internal/sdk/models/operations/deletev1teamsteamidsignalrulesid.go deleted file mode 100644 index 6468f60..0000000 --- a/internal/sdk/models/operations/deletev1teamsteamidsignalrulesid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1TeamsTeamIDSignalRulesIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1TeamsTeamIDSignalRulesIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *DeleteV1TeamsTeamIDSignalRulesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1TeamsTeamIDSignalRulesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1TeamsTeamIDSignalRulesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TeamsTeamIDSignalRulesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TeamsTeamIDSignalRulesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1ticketingprioritiesid.go b/internal/sdk/models/operations/deletev1ticketingprioritiesid.go deleted file mode 100644 index b2ea329..0000000 --- a/internal/sdk/models/operations/deletev1ticketingprioritiesid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1TicketingPrioritiesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *DeleteV1TicketingPrioritiesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type DeleteV1TicketingPrioritiesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Delete a single ticketing priority by ID - TicketingPriorityEntity *shared.TicketingPriorityEntity -} - -func (o *DeleteV1TicketingPrioritiesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TicketingPrioritiesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TicketingPrioritiesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1TicketingPrioritiesIDResponse) GetTicketingPriorityEntity() *shared.TicketingPriorityEntity { - if o == nil { - return nil - } - return o.TicketingPriorityEntity -} diff --git a/internal/sdk/models/operations/deletev1ticketingprojectsticketingprojectidfieldmapsmapid.go b/internal/sdk/models/operations/deletev1ticketingprojectsticketingprojectidfieldmapsmapid.go deleted file mode 100644 index 09c12c1..0000000 --- a/internal/sdk/models/operations/deletev1ticketingprojectsticketingprojectidfieldmapsmapid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest struct { - MapID string `pathParam:"style=simple,explode=false,name=map_id"` - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest) GetMapID() string { - if o == nil { - return "" - } - return o.MapID -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go b/internal/sdk/models/operations/deletev1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go deleted file mode 100644 index d7ac912..0000000 --- a/internal/sdk/models/operations/deletev1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest struct { - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` - ConfigID string `pathParam:"style=simple,explode=false,name=config_id"` -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest) GetConfigID() string { - if o == nil { - return "" - } - return o.ConfigID -} - -type DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Archive configuration for a ticketing project - TicketingProjectConfigEntity *shared.TicketingProjectConfigEntity -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetTicketingProjectConfigEntity() *shared.TicketingProjectConfigEntity { - if o == nil { - return nil - } - return o.TicketingProjectConfigEntity -} diff --git a/internal/sdk/models/operations/deletev1ticketingticketsticketid.go b/internal/sdk/models/operations/deletev1ticketingticketsticketid.go deleted file mode 100644 index 4e50565..0000000 --- a/internal/sdk/models/operations/deletev1ticketingticketsticketid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1TicketingTicketsTicketIDRequest struct { - TicketID string `pathParam:"style=simple,explode=false,name=ticket_id"` -} - -func (o *DeleteV1TicketingTicketsTicketIDRequest) GetTicketID() string { - if o == nil { - return "" - } - return o.TicketID -} - -type DeleteV1TicketingTicketsTicketIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1TicketingTicketsTicketIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1TicketingTicketsTicketIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1TicketingTicketsTicketIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/deletev1webhookswebhookid.go b/internal/sdk/models/operations/deletev1webhookswebhookid.go deleted file mode 100644 index 1fe2b1a..0000000 --- a/internal/sdk/models/operations/deletev1webhookswebhookid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type DeleteV1WebhooksWebhookIDRequest struct { - WebhookID string `pathParam:"style=simple,explode=false,name=webhook_id"` -} - -func (o *DeleteV1WebhooksWebhookIDRequest) GetWebhookID() string { - if o == nil { - return "" - } - return o.WebhookID -} - -type DeleteV1WebhooksWebhookIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *DeleteV1WebhooksWebhookIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *DeleteV1WebhooksWebhookIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *DeleteV1WebhooksWebhookIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1aipreferences.go b/internal/sdk/models/operations/getv1aipreferences.go deleted file mode 100644 index a8b5fb7..0000000 --- a/internal/sdk/models/operations/getv1aipreferences.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1AiPreferencesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves the current AI preferences - AIEntitiesPreferencesEntity *shared.AIEntitiesPreferencesEntity -} - -func (o *GetV1AiPreferencesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1AiPreferencesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1AiPreferencesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1AiPreferencesResponse) GetAIEntitiesPreferencesEntity() *shared.AIEntitiesPreferencesEntity { - if o == nil { - return nil - } - return o.AIEntitiesPreferencesEntity -} diff --git a/internal/sdk/models/operations/getv1aisummarizeincidentincidentidgeneratedsummaryidvoted.go b/internal/sdk/models/operations/getv1aisummarizeincidentincidentidgeneratedsummaryidvoted.go deleted file mode 100644 index 2645bf2..0000000 --- a/internal/sdk/models/operations/getv1aisummarizeincidentincidentidgeneratedsummaryidvoted.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - GeneratedSummaryID string `pathParam:"style=simple,explode=false,name=generated_summary_id"` -} - -func (o *GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedRequest) GetGeneratedSummaryID() string { - if o == nil { - return "" - } - return o.GeneratedSummaryID -} - -type GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVotedResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1alerts.go b/internal/sdk/models/operations/getv1alerts.go deleted file mode 100644 index df593f8..0000000 --- a/internal/sdk/models/operations/getv1alerts.go +++ /dev/null @@ -1,188 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// GetV1AlertsQueryParamTagMatchStrategy - The strategy to match tags. `any` will return alerts that have at least one of the supplied tags, `match_all` will return only alerts that have all of the supplied tags, and `exclude` will only return alerts that have none of the supplied tags. This currently only works for Signals alerts. -type GetV1AlertsQueryParamTagMatchStrategy string - -const ( - GetV1AlertsQueryParamTagMatchStrategyAny GetV1AlertsQueryParamTagMatchStrategy = "any" - GetV1AlertsQueryParamTagMatchStrategyMatchAll GetV1AlertsQueryParamTagMatchStrategy = "match_all" - GetV1AlertsQueryParamTagMatchStrategyExclude GetV1AlertsQueryParamTagMatchStrategy = "exclude" -) - -func (e GetV1AlertsQueryParamTagMatchStrategy) ToPointer() *GetV1AlertsQueryParamTagMatchStrategy { - return &e -} -func (e *GetV1AlertsQueryParamTagMatchStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "any": - fallthrough - case "match_all": - fallthrough - case "exclude": - *e = GetV1AlertsQueryParamTagMatchStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1AlertsQueryParamTagMatchStrategy: %v", v) - } -} - -type GetV1AlertsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A text query for alerts - Query *string `queryParam:"style=form,explode=true,name=query"` - // A comma separated list of user IDs. This currently only works for Signals alerts. - Users *string `queryParam:"style=form,explode=true,name=users"` - // A comma separated list of team IDs. This currently only works for Signals alerts. - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of signals rule IDs. This currently only works for Signals alerts. - SignalRules *string `queryParam:"style=form,explode=true,name=signal_rules"` - // A comma separated list of environment IDs. This currently only works for Signals alerts. - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of functionality IDs. This currently only works for Signals alerts. - Functionalities *string `queryParam:"style=form,explode=true,name=functionalities"` - // A comma separated list of service IDs. This currently only works for Signals alerts. - Services *string `queryParam:"style=form,explode=true,name=services"` - // A comma separated list of tags. This currently only works for Signals alerts. - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // The strategy to match tags. `any` will return alerts that have at least one of the supplied tags, `match_all` will return only alerts that have all of the supplied tags, and `exclude` will only return alerts that have none of the supplied tags. This currently only works for Signals alerts. - TagMatchStrategy *GetV1AlertsQueryParamTagMatchStrategy `queryParam:"style=form,explode=true,name=tag_match_strategy"` - // A comma separated list of statuses to filter by. Valid statuses are: opened, acknowledged, resolved, ignored, or expired - Statuses *string `queryParam:"style=form,explode=true,name=statuses"` -} - -func (o *GetV1AlertsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1AlertsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1AlertsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1AlertsRequest) GetUsers() *string { - if o == nil { - return nil - } - return o.Users -} - -func (o *GetV1AlertsRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1AlertsRequest) GetSignalRules() *string { - if o == nil { - return nil - } - return o.SignalRules -} - -func (o *GetV1AlertsRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1AlertsRequest) GetFunctionalities() *string { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *GetV1AlertsRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1AlertsRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1AlertsRequest) GetTagMatchStrategy() *GetV1AlertsQueryParamTagMatchStrategy { - if o == nil { - return nil - } - return o.TagMatchStrategy -} - -func (o *GetV1AlertsRequest) GetStatuses() *string { - if o == nil { - return nil - } - return o.Statuses -} - -type GetV1AlertsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve all alerts from third parties - AlertsAlertEntityPaginated *shared.AlertsAlertEntityPaginated -} - -func (o *GetV1AlertsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1AlertsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1AlertsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1AlertsResponse) GetAlertsAlertEntityPaginated() *shared.AlertsAlertEntityPaginated { - if o == nil { - return nil - } - return o.AlertsAlertEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1alertsalertid.go b/internal/sdk/models/operations/getv1alertsalertid.go deleted file mode 100644 index 1153aab..0000000 --- a/internal/sdk/models/operations/getv1alertsalertid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1AlertsAlertIDRequest struct { - AlertID string `pathParam:"style=simple,explode=false,name=alert_id"` -} - -func (o *GetV1AlertsAlertIDRequest) GetAlertID() string { - if o == nil { - return "" - } - return o.AlertID -} - -type GetV1AlertsAlertIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single alert - AlertsAlertEntity *shared.AlertsAlertEntity -} - -func (o *GetV1AlertsAlertIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1AlertsAlertIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1AlertsAlertIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1AlertsAlertIDResponse) GetAlertsAlertEntity() *shared.AlertsAlertEntity { - if o == nil { - return nil - } - return o.AlertsAlertEntity -} diff --git a/internal/sdk/models/operations/getv1bootstrap.go b/internal/sdk/models/operations/getv1bootstrap.go deleted file mode 100644 index 908861c..0000000 --- a/internal/sdk/models/operations/getv1bootstrap.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1BootstrapResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1BootstrapResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1BootstrapResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1BootstrapResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1catalogscatalogidrefresh.go b/internal/sdk/models/operations/getv1catalogscatalogidrefresh.go deleted file mode 100644 index 242c0d9..0000000 --- a/internal/sdk/models/operations/getv1catalogscatalogidrefresh.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1CatalogsCatalogIDRefreshRequest struct { - CatalogID string `pathParam:"style=simple,explode=false,name=catalog_id"` -} - -func (o *GetV1CatalogsCatalogIDRefreshRequest) GetCatalogID() string { - if o == nil { - return "" - } - return o.CatalogID -} - -type GetV1CatalogsCatalogIDRefreshResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1CatalogsCatalogIDRefreshResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1CatalogsCatalogIDRefreshResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1CatalogsCatalogIDRefreshResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1changes.go b/internal/sdk/models/operations/getv1changes.go deleted file mode 100644 index 628e3ca..0000000 --- a/internal/sdk/models/operations/getv1changes.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1ChangesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // Filter changes by summary - Query *string `queryParam:"style=form,explode=true,name=query"` -} - -func (o *GetV1ChangesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1ChangesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1ChangesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -type GetV1ChangesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1ChangesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ChangesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ChangesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1changeschangeididentities.go b/internal/sdk/models/operations/getv1changeschangeididentities.go deleted file mode 100644 index e8a5769..0000000 --- a/internal/sdk/models/operations/getv1changeschangeididentities.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ChangesChangeIDIdentitiesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - ChangeID string `pathParam:"style=simple,explode=false,name=change_id"` -} - -func (o *GetV1ChangesChangeIDIdentitiesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1ChangesChangeIDIdentitiesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1ChangesChangeIDIdentitiesRequest) GetChangeID() string { - if o == nil { - return "" - } - return o.ChangeID -} - -type GetV1ChangesChangeIDIdentitiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve all identities for the change - ChangeIdentityEntityPaginated *shared.ChangeIdentityEntityPaginated -} - -func (o *GetV1ChangesChangeIDIdentitiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ChangesChangeIDIdentitiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ChangesChangeIDIdentitiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ChangesChangeIDIdentitiesResponse) GetChangeIdentityEntityPaginated() *shared.ChangeIdentityEntityPaginated { - if o == nil { - return nil - } - return o.ChangeIdentityEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1changesevents.go b/internal/sdk/models/operations/getv1changesevents.go deleted file mode 100644 index 9a55943..0000000 --- a/internal/sdk/models/operations/getv1changesevents.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "time" -) - -type GetV1ChangesEventsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // The id of a previously saved search. - SavedSearchID *string `queryParam:"style=form,explode=true,name=saved_search_id"` - // A text query for change events - Query *string `queryParam:"style=form,explode=true,name=query"` - // A comma separated list of label key / values in the format of "key=value,key2=value2". To filter change events that have a key (with no specific value), omit the value - Labels *string `queryParam:"style=form,explode=true,name=labels"` - // A comma separated list of environment IDs - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of service IDs - Services *string `queryParam:"style=form,explode=true,name=services"` - // The start time to start returning change events from - StartsAt *string `queryParam:"style=form,explode=true,name=starts_at"` - // The end time to return change events up to - EndsAt *time.Time `queryParam:"style=form,explode=true,name=ends_at"` -} - -func (g GetV1ChangesEventsRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1ChangesEventsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1ChangesEventsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1ChangesEventsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1ChangesEventsRequest) GetSavedSearchID() *string { - if o == nil { - return nil - } - return o.SavedSearchID -} - -func (o *GetV1ChangesEventsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1ChangesEventsRequest) GetLabels() *string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *GetV1ChangesEventsRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1ChangesEventsRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1ChangesEventsRequest) GetStartsAt() *string { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *GetV1ChangesEventsRequest) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -type GetV1ChangesEventsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List change events for the organization. Note: Not all information is included on a change event like attachments and related changes. You must fetch a change event separately to retrieve all of the information about it - ChangeEventSlimEntityPaginated *shared.ChangeEventSlimEntityPaginated -} - -func (o *GetV1ChangesEventsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ChangesEventsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ChangesEventsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ChangesEventsResponse) GetChangeEventSlimEntityPaginated() *shared.ChangeEventSlimEntityPaginated { - if o == nil { - return nil - } - return o.ChangeEventSlimEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1changeseventschangeeventid.go b/internal/sdk/models/operations/getv1changeseventschangeeventid.go deleted file mode 100644 index bb940ff..0000000 --- a/internal/sdk/models/operations/getv1changeseventschangeeventid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ChangesEventsChangeEventIDRequest struct { - ChangeEventID string `pathParam:"style=simple,explode=false,name=change_event_id"` -} - -func (o *GetV1ChangesEventsChangeEventIDRequest) GetChangeEventID() string { - if o == nil { - return "" - } - return o.ChangeEventID -} - -type GetV1ChangesEventsChangeEventIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a change event - ChangeEventEntity *shared.ChangeEventEntity -} - -func (o *GetV1ChangesEventsChangeEventIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ChangesEventsChangeEventIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ChangesEventsChangeEventIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ChangesEventsChangeEventIDResponse) GetChangeEventEntity() *shared.ChangeEventEntity { - if o == nil { - return nil - } - return o.ChangeEventEntity -} diff --git a/internal/sdk/models/operations/getv1changetypes.go b/internal/sdk/models/operations/getv1changetypes.go deleted file mode 100644 index 3601bd6..0000000 --- a/internal/sdk/models/operations/getv1changetypes.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ChangeTypesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1ChangeTypesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1ChangeTypesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1ChangeTypesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists all change types - ChangeTypeEntityPaginated *shared.ChangeTypeEntityPaginated -} - -func (o *GetV1ChangeTypesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ChangeTypesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ChangeTypesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ChangeTypesResponse) GetChangeTypeEntityPaginated() *shared.ChangeTypeEntityPaginated { - if o == nil { - return nil - } - return o.ChangeTypeEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1checklisttemplates.go b/internal/sdk/models/operations/getv1checklisttemplates.go deleted file mode 100644 index b8130de..0000000 --- a/internal/sdk/models/operations/getv1checklisttemplates.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ChecklistTemplatesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A query to search checklist templates by their name - Query *string `queryParam:"style=form,explode=true,name=query"` -} - -func (o *GetV1ChecklistTemplatesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1ChecklistTemplatesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1ChecklistTemplatesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -type GetV1ChecklistTemplatesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the checklist templates that have been added to the organization - ChecklistTemplateEntityPaginated *shared.ChecklistTemplateEntityPaginated -} - -func (o *GetV1ChecklistTemplatesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ChecklistTemplatesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ChecklistTemplatesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ChecklistTemplatesResponse) GetChecklistTemplateEntityPaginated() *shared.ChecklistTemplateEntityPaginated { - if o == nil { - return nil - } - return o.ChecklistTemplateEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1checklisttemplatesid.go b/internal/sdk/models/operations/getv1checklisttemplatesid.go deleted file mode 100644 index 3cecf52..0000000 --- a/internal/sdk/models/operations/getv1checklisttemplatesid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ChecklistTemplatesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1ChecklistTemplatesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1ChecklistTemplatesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a single checklist template by ID - ChecklistTemplateEntity *shared.ChecklistTemplateEntity -} - -func (o *GetV1ChecklistTemplatesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ChecklistTemplatesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ChecklistTemplatesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ChecklistTemplatesIDResponse) GetChecklistTemplateEntity() *shared.ChecklistTemplateEntity { - if o == nil { - return nil - } - return o.ChecklistTemplateEntity -} diff --git a/internal/sdk/models/operations/getv1conversationsconversationidcomments.go b/internal/sdk/models/operations/getv1conversationsconversationidcomments.go deleted file mode 100644 index 735e134..0000000 --- a/internal/sdk/models/operations/getv1conversationsconversationidcomments.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "net/http" - "time" -) - -// GetV1ConversationsConversationIDCommentsQueryParamSort - Allows sorting comments by the time they were posted, ascending or descending. -type GetV1ConversationsConversationIDCommentsQueryParamSort string - -const ( - GetV1ConversationsConversationIDCommentsQueryParamSortAsc GetV1ConversationsConversationIDCommentsQueryParamSort = "asc" - GetV1ConversationsConversationIDCommentsQueryParamSortDesc GetV1ConversationsConversationIDCommentsQueryParamSort = "desc" -) - -func (e GetV1ConversationsConversationIDCommentsQueryParamSort) ToPointer() *GetV1ConversationsConversationIDCommentsQueryParamSort { - return &e -} -func (e *GetV1ConversationsConversationIDCommentsQueryParamSort) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "asc": - fallthrough - case "desc": - *e = GetV1ConversationsConversationIDCommentsQueryParamSort(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1ConversationsConversationIDCommentsQueryParamSort: %v", v) - } -} - -type GetV1ConversationsConversationIDCommentsRequest struct { - // An ISO8601 timestamp that allows filtering for comments posted before the provided time. - Before *time.Time `queryParam:"style=form,explode=true,name=before"` - // An ISO8601 timestamp that allows filtering for comments posted after the provided time. - After *time.Time `queryParam:"style=form,explode=true,name=after"` - // Allows sorting comments by the time they were posted, ascending or descending. - Sort *GetV1ConversationsConversationIDCommentsQueryParamSort `default:"asc" queryParam:"style=form,explode=true,name=sort"` - ConversationID string `pathParam:"style=simple,explode=false,name=conversation_id"` -} - -func (g GetV1ConversationsConversationIDCommentsRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1ConversationsConversationIDCommentsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1ConversationsConversationIDCommentsRequest) GetBefore() *time.Time { - if o == nil { - return nil - } - return o.Before -} - -func (o *GetV1ConversationsConversationIDCommentsRequest) GetAfter() *time.Time { - if o == nil { - return nil - } - return o.After -} - -func (o *GetV1ConversationsConversationIDCommentsRequest) GetSort() *GetV1ConversationsConversationIDCommentsQueryParamSort { - if o == nil { - return nil - } - return o.Sort -} - -func (o *GetV1ConversationsConversationIDCommentsRequest) GetConversationID() string { - if o == nil { - return "" - } - return o.ConversationID -} - -type GetV1ConversationsConversationIDCommentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1ConversationsConversationIDCommentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ConversationsConversationIDCommentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ConversationsConversationIDCommentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1conversationsconversationidcommentscommentid.go b/internal/sdk/models/operations/getv1conversationsconversationidcommentscommentid.go deleted file mode 100644 index 9763829..0000000 --- a/internal/sdk/models/operations/getv1conversationsconversationidcommentscommentid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1ConversationsConversationIDCommentsCommentIDRequest struct { - CommentID string `pathParam:"style=simple,explode=false,name=comment_id"` - ConversationID string `pathParam:"style=simple,explode=false,name=conversation_id"` -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDRequest) GetCommentID() string { - if o == nil { - return "" - } - return o.CommentID -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDRequest) GetConversationID() string { - if o == nil { - return "" - } - return o.ConversationID -} - -type GetV1ConversationsConversationIDCommentsCommentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1conversationsconversationidcommentscommentidreactions.go b/internal/sdk/models/operations/getv1conversationsconversationidcommentscommentidreactions.go deleted file mode 100644 index b030460..0000000 --- a/internal/sdk/models/operations/getv1conversationsconversationidcommentscommentidreactions.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1ConversationsConversationIDCommentsCommentIDReactionsRequest struct { - ConversationID string `pathParam:"style=simple,explode=false,name=conversation_id"` - CommentID string `pathParam:"style=simple,explode=false,name=comment_id"` -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDReactionsRequest) GetConversationID() string { - if o == nil { - return "" - } - return o.ConversationID -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDReactionsRequest) GetCommentID() string { - if o == nil { - return "" - } - return o.CommentID -} - -type GetV1ConversationsConversationIDCommentsCommentIDReactionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDReactionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDReactionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ConversationsConversationIDCommentsCommentIDReactionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1currentuser.go b/internal/sdk/models/operations/getv1currentuser.go deleted file mode 100644 index 9aa1228..0000000 --- a/internal/sdk/models/operations/getv1currentuser.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1CurrentUserResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve the current user - CurrentUserEntity *shared.CurrentUserEntity -} - -func (o *GetV1CurrentUserResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1CurrentUserResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1CurrentUserResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1CurrentUserResponse) GetCurrentUserEntity() *shared.CurrentUserEntity { - if o == nil { - return nil - } - return o.CurrentUserEntity -} diff --git a/internal/sdk/models/operations/getv1customfieldsdefinitions.go b/internal/sdk/models/operations/getv1customfieldsdefinitions.go deleted file mode 100644 index c4d91c8..0000000 --- a/internal/sdk/models/operations/getv1customfieldsdefinitions.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1CustomFieldsDefinitionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all custom field definitions - OrganizationsCustomFieldDefinitionEntity *shared.OrganizationsCustomFieldDefinitionEntity -} - -func (o *GetV1CustomFieldsDefinitionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1CustomFieldsDefinitionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1CustomFieldsDefinitionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1CustomFieldsDefinitionsResponse) GetOrganizationsCustomFieldDefinitionEntity() *shared.OrganizationsCustomFieldDefinitionEntity { - if o == nil { - return nil - } - return o.OrganizationsCustomFieldDefinitionEntity -} diff --git a/internal/sdk/models/operations/getv1customfieldsdefinitionsfieldidselectoptions.go b/internal/sdk/models/operations/getv1customfieldsdefinitionsfieldidselectoptions.go deleted file mode 100644 index 3d88c4d..0000000 --- a/internal/sdk/models/operations/getv1customfieldsdefinitionsfieldidselectoptions.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1CustomFieldsDefinitionsFieldIDSelectOptionsRequest struct { - FieldID string `pathParam:"style=simple,explode=false,name=field_id"` - // Text string of a query for filtering values. - Query *string `queryParam:"style=form,explode=true,name=query"` - // If true, return all versions of the custom field definition. - AllVersions *bool `queryParam:"style=form,explode=true,name=all_versions"` -} - -func (o *GetV1CustomFieldsDefinitionsFieldIDSelectOptionsRequest) GetFieldID() string { - if o == nil { - return "" - } - return o.FieldID -} - -func (o *GetV1CustomFieldsDefinitionsFieldIDSelectOptionsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1CustomFieldsDefinitionsFieldIDSelectOptionsRequest) GetAllVersions() *bool { - if o == nil { - return nil - } - return o.AllVersions -} - -type GetV1CustomFieldsDefinitionsFieldIDSelectOptionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Get the permissible values for the a currently active custom select or multi-select field. - OrganizationsCustomFieldDefinitionEntity *shared.OrganizationsCustomFieldDefinitionEntity -} - -func (o *GetV1CustomFieldsDefinitionsFieldIDSelectOptionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1CustomFieldsDefinitionsFieldIDSelectOptionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1CustomFieldsDefinitionsFieldIDSelectOptionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1CustomFieldsDefinitionsFieldIDSelectOptionsResponse) GetOrganizationsCustomFieldDefinitionEntity() *shared.OrganizationsCustomFieldDefinitionEntity { - if o == nil { - return nil - } - return o.OrganizationsCustomFieldDefinitionEntity -} diff --git a/internal/sdk/models/operations/getv1entitlements.go b/internal/sdk/models/operations/getv1entitlements.go deleted file mode 100644 index c23d115..0000000 --- a/internal/sdk/models/operations/getv1entitlements.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// Type of Entitlement -type Type string - -const ( - TypeQuota Type = "quota" - TypeAccess Type = "access" -) - -func (e Type) ToPointer() *Type { - return &e -} -func (e *Type) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "quota": - fallthrough - case "access": - *e = Type(v) - return nil - default: - return fmt.Errorf("invalid value for Type: %v", v) - } -} - -type GetV1EntitlementsRequest struct { - // Name of Entitlement - Name *string `queryParam:"style=form,explode=true,name=name"` - // Type of Entitlement - Type *Type `queryParam:"style=form,explode=true,name=type"` -} - -func (o *GetV1EntitlementsRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1EntitlementsRequest) GetType() *Type { - if o == nil { - return nil - } - return o.Type -} - -type GetV1EntitlementsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve all entitlements - EntitlementEntityPaginated *shared.EntitlementEntityPaginated -} - -func (o *GetV1EntitlementsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1EntitlementsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1EntitlementsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1EntitlementsResponse) GetEntitlementEntityPaginated() *shared.EntitlementEntityPaginated { - if o == nil { - return nil - } - return o.EntitlementEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1environments.go b/internal/sdk/models/operations/getv1environments.go deleted file mode 100644 index c86d0da..0000000 --- a/internal/sdk/models/operations/getv1environments.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1EnvironmentsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A query to search environments by their name or description - Query *string `queryParam:"style=form,explode=true,name=query"` - // A query to search environments by their name - Name *string `queryParam:"style=form,explode=true,name=name"` -} - -func (o *GetV1EnvironmentsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1EnvironmentsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1EnvironmentsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1EnvironmentsRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -type GetV1EnvironmentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the environments that have been added to the organiation - EnvironmentEntryEntityPaginated *shared.EnvironmentEntryEntityPaginated -} - -func (o *GetV1EnvironmentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1EnvironmentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1EnvironmentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1EnvironmentsResponse) GetEnvironmentEntryEntityPaginated() *shared.EnvironmentEntryEntityPaginated { - if o == nil { - return nil - } - return o.EnvironmentEntryEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1environmentsenvironmentid.go b/internal/sdk/models/operations/getv1environmentsenvironmentid.go deleted file mode 100644 index ad7333f..0000000 --- a/internal/sdk/models/operations/getv1environmentsenvironmentid.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1EnvironmentsEnvironmentIDRequest struct { - // Environment UUID - EnvironmentID string `pathParam:"style=simple,explode=false,name=environment_id"` -} - -func (o *GetV1EnvironmentsEnvironmentIDRequest) GetEnvironmentID() string { - if o == nil { - return "" - } - return o.EnvironmentID -} - -type GetV1EnvironmentsEnvironmentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a single environment by ID - EnvironmentEntryEntity *shared.EnvironmentEntryEntity -} - -func (o *GetV1EnvironmentsEnvironmentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1EnvironmentsEnvironmentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1EnvironmentsEnvironmentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1EnvironmentsEnvironmentIDResponse) GetEnvironmentEntryEntity() *shared.EnvironmentEntryEntity { - if o == nil { - return nil - } - return o.EnvironmentEntryEntity -} diff --git a/internal/sdk/models/operations/getv1formconfigurationsslug.go b/internal/sdk/models/operations/getv1formconfigurationsslug.go deleted file mode 100644 index 4915778..0000000 --- a/internal/sdk/models/operations/getv1formconfigurationsslug.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1FormConfigurationsSlugRequest struct { - Slug string `pathParam:"style=simple,explode=false,name=slug"` -} - -func (o *GetV1FormConfigurationsSlugRequest) GetSlug() string { - if o == nil { - return "" - } - return o.Slug -} - -type GetV1FormConfigurationsSlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1FormConfigurationsSlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1FormConfigurationsSlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1FormConfigurationsSlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1functionalities.go b/internal/sdk/models/operations/getv1functionalities.go deleted file mode 100644 index 562b875..0000000 --- a/internal/sdk/models/operations/getv1functionalities.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1FunctionalitiesRequest struct { - // A query to search functionalities by their name or description - Query *string `queryParam:"style=form,explode=true,name=query"` - // A query to search functionalities by their name - Name *string `queryParam:"style=form,explode=true,name=name"` - // A query to search services by if they are impacted with active incidents - Impacted *string `queryParam:"style=form,explode=true,name=impacted"` - // A comma separated list of label key / values in the format of 'key=value,key2=value2'. To filter change events that have a key (with no specific value), omit the value - Labels *string `queryParam:"style=form,explode=true,name=labels"` - // A query to search functionalities by their owning team ID - Owner *string `queryParam:"style=form,explode=true,name=owner"` - // Boolean to determine whether to return a slimified version of the functionalities object - Lite *bool `queryParam:"style=form,explode=true,name=lite"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1FunctionalitiesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1FunctionalitiesRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1FunctionalitiesRequest) GetImpacted() *string { - if o == nil { - return nil - } - return o.Impacted -} - -func (o *GetV1FunctionalitiesRequest) GetLabels() *string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *GetV1FunctionalitiesRequest) GetOwner() *string { - if o == nil { - return nil - } - return o.Owner -} - -func (o *GetV1FunctionalitiesRequest) GetLite() *bool { - if o == nil { - return nil - } - return o.Lite -} - -func (o *GetV1FunctionalitiesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1FunctionalitiesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1FunctionalitiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the functionalities that have been added to the organiation - FunctionalityEntityPaginated *shared.FunctionalityEntityPaginated -} - -func (o *GetV1FunctionalitiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1FunctionalitiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1FunctionalitiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1FunctionalitiesResponse) GetFunctionalityEntityPaginated() *shared.FunctionalityEntityPaginated { - if o == nil { - return nil - } - return o.FunctionalityEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1functionalitiesfunctionalityid.go b/internal/sdk/models/operations/getv1functionalitiesfunctionalityid.go deleted file mode 100644 index 81068f1..0000000 --- a/internal/sdk/models/operations/getv1functionalitiesfunctionalityid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1FunctionalitiesFunctionalityIDRequest struct { - FunctionalityID string `pathParam:"style=simple,explode=false,name=functionality_id"` -} - -func (o *GetV1FunctionalitiesFunctionalityIDRequest) GetFunctionalityID() string { - if o == nil { - return "" - } - return o.FunctionalityID -} - -type GetV1FunctionalitiesFunctionalityIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a single functionality by ID - FunctionalityEntity *shared.FunctionalityEntity -} - -func (o *GetV1FunctionalitiesFunctionalityIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1FunctionalitiesFunctionalityIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1FunctionalitiesFunctionalityIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1FunctionalitiesFunctionalityIDResponse) GetFunctionalityEntity() *shared.FunctionalityEntity { - if o == nil { - return nil - } - return o.FunctionalityEntity -} diff --git a/internal/sdk/models/operations/getv1functionalitiesfunctionalityidservices.go b/internal/sdk/models/operations/getv1functionalitiesfunctionalityidservices.go deleted file mode 100644 index 13b49dd..0000000 --- a/internal/sdk/models/operations/getv1functionalitiesfunctionalityidservices.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1FunctionalitiesFunctionalityIDServicesRequest struct { - FunctionalityID string `pathParam:"style=simple,explode=false,name=functionality_id"` -} - -func (o *GetV1FunctionalitiesFunctionalityIDServicesRequest) GetFunctionalityID() string { - if o == nil { - return "" - } - return o.FunctionalityID -} - -type GetV1FunctionalitiesFunctionalityIDServicesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1FunctionalitiesFunctionalityIDServicesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1FunctionalitiesFunctionalityIDServicesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1FunctionalitiesFunctionalityIDServicesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1incidentroles.go b/internal/sdk/models/operations/getv1incidentroles.go deleted file mode 100644 index 7155b1b..0000000 --- a/internal/sdk/models/operations/getv1incidentroles.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentRolesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1IncidentRolesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IncidentRolesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1IncidentRolesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the incident roles in the organization - IncidentRoleEntityPaginated *shared.IncidentRoleEntityPaginated -} - -func (o *GetV1IncidentRolesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentRolesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentRolesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentRolesResponse) GetIncidentRoleEntityPaginated() *shared.IncidentRoleEntityPaginated { - if o == nil { - return nil - } - return o.IncidentRoleEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentrolesincidentroleid.go b/internal/sdk/models/operations/getv1incidentrolesincidentroleid.go deleted file mode 100644 index 163da4e..0000000 --- a/internal/sdk/models/operations/getv1incidentrolesincidentroleid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentRolesIncidentRoleIDRequest struct { - IncidentRoleID string `pathParam:"style=simple,explode=false,name=incident_role_id"` -} - -func (o *GetV1IncidentRolesIncidentRoleIDRequest) GetIncidentRoleID() string { - if o == nil { - return "" - } - return o.IncidentRoleID -} - -type GetV1IncidentRolesIncidentRoleIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single incident role from its ID - IncidentRoleEntity *shared.IncidentRoleEntity -} - -func (o *GetV1IncidentRolesIncidentRoleIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentRolesIncidentRoleIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentRolesIncidentRoleIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentRolesIncidentRoleIDResponse) GetIncidentRoleEntity() *shared.IncidentRoleEntity { - if o == nil { - return nil - } - return o.IncidentRoleEntity -} diff --git a/internal/sdk/models/operations/getv1incidents.go b/internal/sdk/models/operations/getv1incidents.go deleted file mode 100644 index f602e26..0000000 --- a/internal/sdk/models/operations/getv1incidents.go +++ /dev/null @@ -1,364 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" - "time" -) - -// TagMatchStrategy - A matching strategy for the tags provided -type TagMatchStrategy string - -const ( - TagMatchStrategyAny TagMatchStrategy = "any" - TagMatchStrategyMatchAll TagMatchStrategy = "match_all" - TagMatchStrategyExclude TagMatchStrategy = "exclude" -) - -func (e TagMatchStrategy) ToPointer() *TagMatchStrategy { - return &e -} -func (e *TagMatchStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "any": - fallthrough - case "match_all": - fallthrough - case "exclude": - *e = TagMatchStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for TagMatchStrategy: %v", v) - } -} - -type GetV1IncidentsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A JSON string that defines 'logic' and 'user_data' - Conditions *string `queryParam:"style=form,explode=true,name=conditions"` - // A comma separated list of environment IDs or 'is_empty' to filter for incidents with no impacted environments - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of service IDs or 'is_empty' to filter for incidents with no impacted services - Services *string `queryParam:"style=form,explode=true,name=services"` - // A comma separated list of functionality IDs or 'is_empty' to filter for incidents with no impacted functionalities - Functionalities *string `queryParam:"style=form,explode=true,name=functionalities"` - // A comma separated list of infrastructure IDs. Returns incidents that do not have the following infrastructure ids associated with them. - ExcludedInfrastructureIds *string `queryParam:"style=form,explode=true,name=excluded_infrastructure_ids"` - // A comma separated list of team IDs - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of IDs for assigned teams or 'is_empty' to filter for incidents with no active team assignments - AssignedTeams *string `queryParam:"style=form,explode=true,name=assigned_teams"` - // Incident status - Status *string `queryParam:"style=form,explode=true,name=status"` - // Filters for incidents that started on or after this date - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // Filters for incidents that started on or before this date - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` - // Filters for incidents that were resolved at or after this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active. - ResolvedAtOrAfter *time.Time `queryParam:"style=form,explode=true,name=resolved_at_or_after"` - // Filters for incidents that were resolved at or before this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active. - ResolvedAtOrBefore *time.Time `queryParam:"style=form,explode=true,name=resolved_at_or_before"` - // Filters for incidents that were created at or after this time - CreatedAtOrAfter *time.Time `queryParam:"style=form,explode=true,name=created_at_or_after"` - // Filters for incidents that were created at or before this time - CreatedAtOrBefore *time.Time `queryParam:"style=form,explode=true,name=created_at_or_before"` - // A text query for an incident that searches on name, summary, and desciption - Query *string `queryParam:"style=form,explode=true,name=query"` - // A query to search incidents by their name - Name *string `queryParam:"style=form,explode=true,name=name"` - // The id of a previously saved search. - SavedSearchID *string `queryParam:"style=form,explode=true,name=saved_search_id"` - // A text value of priority - Priorities *string `queryParam:"style=form,explode=true,name=priorities"` - // Flag for including incidents where priority has not been set - PriorityNotSet *bool `queryParam:"style=form,explode=true,name=priority_not_set"` - // A text value of severity - Severities *string `queryParam:"style=form,explode=true,name=severities"` - // Flag for including incidents where severity has not been set - SeverityNotSet *bool `queryParam:"style=form,explode=true,name=severity_not_set"` - // A comma separated list of current milestones - CurrentMilestones *string `queryParam:"style=form,explode=true,name=current_milestones"` - // A comma separated list of tags - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // A matching strategy for the tags provided - TagMatchStrategy *TagMatchStrategy `queryParam:"style=form,explode=true,name=tag_match_strategy"` - // Return archived incidents - Archived *bool `queryParam:"style=form,explode=true,name=archived"` - // Filters for incidents that were updated after this date - UpdatedAfter *time.Time `queryParam:"style=form,explode=true,name=updated_after"` - // Filters for incidents that were updated before this date - UpdatedBefore *time.Time `queryParam:"style=form,explode=true,name=updated_before"` - // A comma separated list of incident type IDs - IncidentTypeID *string `queryParam:"style=form,explode=true,name=incident_type_id"` -} - -func (g GetV1IncidentsRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1IncidentsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1IncidentsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IncidentsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1IncidentsRequest) GetConditions() *string { - if o == nil { - return nil - } - return o.Conditions -} - -func (o *GetV1IncidentsRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1IncidentsRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1IncidentsRequest) GetFunctionalities() *string { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *GetV1IncidentsRequest) GetExcludedInfrastructureIds() *string { - if o == nil { - return nil - } - return o.ExcludedInfrastructureIds -} - -func (o *GetV1IncidentsRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1IncidentsRequest) GetAssignedTeams() *string { - if o == nil { - return nil - } - return o.AssignedTeams -} - -func (o *GetV1IncidentsRequest) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *GetV1IncidentsRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1IncidentsRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -func (o *GetV1IncidentsRequest) GetResolvedAtOrAfter() *time.Time { - if o == nil { - return nil - } - return o.ResolvedAtOrAfter -} - -func (o *GetV1IncidentsRequest) GetResolvedAtOrBefore() *time.Time { - if o == nil { - return nil - } - return o.ResolvedAtOrBefore -} - -func (o *GetV1IncidentsRequest) GetCreatedAtOrAfter() *time.Time { - if o == nil { - return nil - } - return o.CreatedAtOrAfter -} - -func (o *GetV1IncidentsRequest) GetCreatedAtOrBefore() *time.Time { - if o == nil { - return nil - } - return o.CreatedAtOrBefore -} - -func (o *GetV1IncidentsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1IncidentsRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1IncidentsRequest) GetSavedSearchID() *string { - if o == nil { - return nil - } - return o.SavedSearchID -} - -func (o *GetV1IncidentsRequest) GetPriorities() *string { - if o == nil { - return nil - } - return o.Priorities -} - -func (o *GetV1IncidentsRequest) GetPriorityNotSet() *bool { - if o == nil { - return nil - } - return o.PriorityNotSet -} - -func (o *GetV1IncidentsRequest) GetSeverities() *string { - if o == nil { - return nil - } - return o.Severities -} - -func (o *GetV1IncidentsRequest) GetSeverityNotSet() *bool { - if o == nil { - return nil - } - return o.SeverityNotSet -} - -func (o *GetV1IncidentsRequest) GetCurrentMilestones() *string { - if o == nil { - return nil - } - return o.CurrentMilestones -} - -func (o *GetV1IncidentsRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1IncidentsRequest) GetTagMatchStrategy() *TagMatchStrategy { - if o == nil { - return nil - } - return o.TagMatchStrategy -} - -func (o *GetV1IncidentsRequest) GetArchived() *bool { - if o == nil { - return nil - } - return o.Archived -} - -func (o *GetV1IncidentsRequest) GetUpdatedAfter() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAfter -} - -func (o *GetV1IncidentsRequest) GetUpdatedBefore() *time.Time { - if o == nil { - return nil - } - return o.UpdatedBefore -} - -func (o *GetV1IncidentsRequest) GetIncidentTypeID() *string { - if o == nil { - return nil - } - return o.IncidentTypeID -} - -type GetV1IncidentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the incidents in the organization - IncidentEntityPaginated *shared.IncidentEntityPaginated -} - -func (o *GetV1IncidentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsResponse) GetIncidentEntityPaginated() *shared.IncidentEntityPaginated { - if o == nil { - return nil - } - return o.IncidentEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentid.go b/internal/sdk/models/operations/getv1incidentsincidentid.go deleted file mode 100644 index 84b6dc3..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single incident from its ID - IncidentEntity *shared.IncidentEntity -} - -func (o *GetV1IncidentsIncidentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidalerts.go b/internal/sdk/models/operations/getv1incidentsincidentidalerts.go deleted file mode 100644 index 57628fb..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidalerts.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDAlertsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDAlertsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDAlertsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List alerts that have been attached to an incident - IncidentsAlertEntityPaginated *shared.IncidentsAlertEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDAlertsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDAlertsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDAlertsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDAlertsResponse) GetIncidentsAlertEntityPaginated() *shared.IncidentsAlertEntityPaginated { - if o == nil { - return nil - } - return o.IncidentsAlertEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidattachments.go b/internal/sdk/models/operations/getv1incidentsincidentidattachments.go deleted file mode 100644 index 9a0ac36..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidattachments.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IncidentsIncidentIDAttachmentsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - AttachableType *string `queryParam:"style=form,explode=true,name=attachable_type"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1IncidentsIncidentIDAttachmentsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *GetV1IncidentsIncidentIDAttachmentsRequest) GetAttachableType() *string { - if o == nil { - return nil - } - return o.AttachableType -} - -func (o *GetV1IncidentsIncidentIDAttachmentsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IncidentsIncidentIDAttachmentsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1IncidentsIncidentIDAttachmentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IncidentsIncidentIDAttachmentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDAttachmentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDAttachmentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidchannel.go b/internal/sdk/models/operations/getv1incidentsincidentidchannel.go deleted file mode 100644 index 12e708b..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidchannel.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDChannelRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDChannelRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDChannelResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Gives chat channel information for the specified incident - IncidentsChannelEntity *shared.IncidentsChannelEntity -} - -func (o *GetV1IncidentsIncidentIDChannelResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDChannelResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDChannelResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDChannelResponse) GetIncidentsChannelEntity() *shared.IncidentsChannelEntity { - if o == nil { - return nil - } - return o.IncidentsChannelEntity -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidevents.go b/internal/sdk/models/operations/getv1incidentsincidentidevents.go deleted file mode 100644 index 7909a6c..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidevents.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDEventsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - // A comma separated list of types of events to filter by - Types *string `queryParam:"style=form,explode=true,name=types"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1IncidentsIncidentIDEventsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *GetV1IncidentsIncidentIDEventsRequest) GetTypes() *string { - if o == nil { - return nil - } - return o.Types -} - -func (o *GetV1IncidentsIncidentIDEventsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IncidentsIncidentIDEventsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1IncidentsIncidentIDEventsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all events for an incident. An event is a timeline entry. This can be filtered with params to retrieve events of a certain type. - IncidentEventEntityPaginated *shared.IncidentEventEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDEventsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDEventsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDEventsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDEventsResponse) GetIncidentEventEntityPaginated() *shared.IncidentEventEntityPaginated { - if o == nil { - return nil - } - return o.IncidentEventEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentideventseventid.go b/internal/sdk/models/operations/getv1incidentsincidentideventseventid.go deleted file mode 100644 index c43350d..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentideventseventid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDEventsEventIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - EventID string `pathParam:"style=simple,explode=false,name=event_id"` -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDRequest) GetEventID() string { - if o == nil { - return "" - } - return o.EventID -} - -type GetV1IncidentsIncidentIDEventsEventIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single event for an incident - IncidentEventEntity *shared.IncidentEventEntity -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDResponse) GetIncidentEventEntity() *shared.IncidentEventEntity { - if o == nil { - return nil - } - return o.IncidentEventEntity -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentideventseventidvotesstatus.go b/internal/sdk/models/operations/getv1incidentsincidentideventseventidvotesstatus.go deleted file mode 100644 index 2044340..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentideventseventidvotesstatus.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDEventsEventIDVotesStatusRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - EventID string `pathParam:"style=simple,explode=false,name=event_id"` -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDVotesStatusRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDVotesStatusRequest) GetEventID() string { - if o == nil { - return "" - } - return o.EventID -} - -type GetV1IncidentsIncidentIDEventsEventIDVotesStatusResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns the current vote counts for an object - VotesEntity *shared.VotesEntity -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDVotesStatusResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDVotesStatusResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDVotesStatusResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDEventsEventIDVotesStatusResponse) GetVotesEntity() *shared.VotesEntity { - if o == nil { - return nil - } - return o.VotesEntity -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidimpacttype.go b/internal/sdk/models/operations/getv1incidentsincidentidimpacttype.go deleted file mode 100644 index 13b28ba..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidimpacttype.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDImpactTypePathParamType string - -const ( - GetV1IncidentsIncidentIDImpactTypePathParamTypeEnvironments GetV1IncidentsIncidentIDImpactTypePathParamType = "environments" - GetV1IncidentsIncidentIDImpactTypePathParamTypeFunctionalities GetV1IncidentsIncidentIDImpactTypePathParamType = "functionalities" - GetV1IncidentsIncidentIDImpactTypePathParamTypeServices GetV1IncidentsIncidentIDImpactTypePathParamType = "services" - GetV1IncidentsIncidentIDImpactTypePathParamTypeCustomers GetV1IncidentsIncidentIDImpactTypePathParamType = "customers" -) - -func (e GetV1IncidentsIncidentIDImpactTypePathParamType) ToPointer() *GetV1IncidentsIncidentIDImpactTypePathParamType { - return &e -} -func (e *GetV1IncidentsIncidentIDImpactTypePathParamType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "environments": - fallthrough - case "functionalities": - fallthrough - case "services": - fallthrough - case "customers": - *e = GetV1IncidentsIncidentIDImpactTypePathParamType(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1IncidentsIncidentIDImpactTypePathParamType: %v", v) - } -} - -type GetV1IncidentsIncidentIDImpactTypeRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - Type GetV1IncidentsIncidentIDImpactTypePathParamType `pathParam:"style=simple,explode=false,name=type"` -} - -func (o *GetV1IncidentsIncidentIDImpactTypeRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *GetV1IncidentsIncidentIDImpactTypeRequest) GetType() GetV1IncidentsIncidentIDImpactTypePathParamType { - if o == nil { - return GetV1IncidentsIncidentIDImpactTypePathParamType("") - } - return o.Type -} - -type GetV1IncidentsIncidentIDImpactTypeResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List impacted infrastructure on an incident by specifying type - IncidentImpactEntityPaginated *shared.IncidentImpactEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDImpactTypeResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDImpactTypeResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDImpactTypeResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDImpactTypeResponse) GetIncidentImpactEntityPaginated() *shared.IncidentImpactEntityPaginated { - if o == nil { - return nil - } - return o.IncidentImpactEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidlinks.go b/internal/sdk/models/operations/getv1incidentsincidentidlinks.go deleted file mode 100644 index b843b1d..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidlinks.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDLinksRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDLinksRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IncidentsIncidentIDLinksRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1IncidentsIncidentIDLinksRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDLinksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all the editable, external incident links attached to an incident - AttachmentsLinkEntityPaginated *shared.AttachmentsLinkEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDLinksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDLinksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDLinksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDLinksResponse) GetAttachmentsLinkEntityPaginated() *shared.AttachmentsLinkEntityPaginated { - if o == nil { - return nil - } - return o.AttachmentsLinkEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidmilestones.go b/internal/sdk/models/operations/getv1incidentsincidentidmilestones.go deleted file mode 100644 index 2ca920c..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidmilestones.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDMilestonesRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDMilestonesRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDMilestonesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List times and durations for each milestone on an incident - IncidentsMilestoneEntityPaginated *shared.IncidentsMilestoneEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDMilestonesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDMilestonesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDMilestonesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDMilestonesResponse) GetIncidentsMilestoneEntityPaginated() *shared.IncidentsMilestoneEntityPaginated { - if o == nil { - return nil - } - return o.IncidentsMilestoneEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidrelatedchangeevents.go b/internal/sdk/models/operations/getv1incidentsincidentidrelatedchangeevents.go deleted file mode 100644 index 612563f..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidrelatedchangeevents.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// QueryParamType - The type of the relation to the incident -type QueryParamType string - -const ( - QueryParamTypeCaused QueryParamType = "caused" - QueryParamTypeFixed QueryParamType = "fixed" - QueryParamTypeSuspect QueryParamType = "suspect" - QueryParamTypeDismissed QueryParamType = "dismissed" -) - -func (e QueryParamType) ToPointer() *QueryParamType { - return &e -} -func (e *QueryParamType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "caused": - fallthrough - case "fixed": - fallthrough - case "suspect": - fallthrough - case "dismissed": - *e = QueryParamType(v) - return nil - default: - return fmt.Errorf("invalid value for QueryParamType: %v", v) - } -} - -type GetV1IncidentsIncidentIDRelatedChangeEventsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // The type of the relation to the incident - Type *QueryParamType `queryParam:"style=form,explode=true,name=type"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDRelatedChangeEventsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IncidentsIncidentIDRelatedChangeEventsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1IncidentsIncidentIDRelatedChangeEventsRequest) GetType() *QueryParamType { - if o == nil { - return nil - } - return o.Type -} - -func (o *GetV1IncidentsIncidentIDRelatedChangeEventsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDRelatedChangeEventsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List related changes that have been attached to an incident - IncidentsRelatedChangeEventEntityPaginated *shared.IncidentsRelatedChangeEventEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDRelatedChangeEventsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDRelatedChangeEventsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDRelatedChangeEventsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDRelatedChangeEventsResponse) GetIncidentsRelatedChangeEventEntityPaginated() *shared.IncidentsRelatedChangeEventEntityPaginated { - if o == nil { - return nil - } - return o.IncidentsRelatedChangeEventEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidrelationships.go b/internal/sdk/models/operations/getv1incidentsincidentidrelationships.go deleted file mode 100644 index 24aa23c..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidrelationships.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDRelationshipsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDRelationshipsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDRelationshipsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List any parent/child relationships for an incident - IncidentsRelationshipsEntity *shared.IncidentsRelationshipsEntity -} - -func (o *GetV1IncidentsIncidentIDRelationshipsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDRelationshipsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDRelationshipsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDRelationshipsResponse) GetIncidentsRelationshipsEntity() *shared.IncidentsRelationshipsEntity { - if o == nil { - return nil - } - return o.IncidentsRelationshipsEntity -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidroleassignments.go b/internal/sdk/models/operations/getv1incidentsincidentidroleassignments.go deleted file mode 100644 index d96ed14..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidroleassignments.go +++ /dev/null @@ -1,96 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// Status - Filter on status of the role assignment -type Status string - -const ( - StatusActive Status = "active" - StatusInactive Status = "inactive" -) - -func (e Status) ToPointer() *Status { - return &e -} -func (e *Status) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "active": - fallthrough - case "inactive": - *e = Status(v) - return nil - default: - return fmt.Errorf("invalid value for Status: %v", v) - } -} - -type GetV1IncidentsIncidentIDRoleAssignmentsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - // Filter on status of the role assignment - Status *Status `queryParam:"style=form,explode=true,name=status"` -} - -func (o *GetV1IncidentsIncidentIDRoleAssignmentsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *GetV1IncidentsIncidentIDRoleAssignmentsRequest) GetStatus() *Status { - if o == nil { - return nil - } - return o.Status -} - -type GetV1IncidentsIncidentIDRoleAssignmentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a list of all of the current role assignments for the incident - IncidentsRoleAssignmentEntityPaginated *shared.IncidentsRoleAssignmentEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDRoleAssignmentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDRoleAssignmentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDRoleAssignmentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDRoleAssignmentsResponse) GetIncidentsRoleAssignmentEntityPaginated() *shared.IncidentsRoleAssignmentEntityPaginated { - if o == nil { - return nil - } - return o.IncidentsRoleAssignmentEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidsimilar.go b/internal/sdk/models/operations/getv1incidentsincidentidsimilar.go deleted file mode 100644 index 646cb74..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidsimilar.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "net/http" -) - -type GetV1IncidentsIncidentIDSimilarRequest struct { - Threshold *float32 `default:"0.2" queryParam:"style=form,explode=true,name=threshold"` - Limit *int `default:"5" queryParam:"style=form,explode=true,name=limit"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (g GetV1IncidentsIncidentIDSimilarRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1IncidentsIncidentIDSimilarRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1IncidentsIncidentIDSimilarRequest) GetThreshold() *float32 { - if o == nil { - return nil - } - return o.Threshold -} - -func (o *GetV1IncidentsIncidentIDSimilarRequest) GetLimit() *int { - if o == nil { - return nil - } - return o.Limit -} - -func (o *GetV1IncidentsIncidentIDSimilarRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDSimilarResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IncidentsIncidentIDSimilarResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDSimilarResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDSimilarResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidstatuspages.go b/internal/sdk/models/operations/getv1incidentsincidentidstatuspages.go deleted file mode 100644 index cee7f0c..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidstatuspages.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDStatusPagesRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDStatusPagesRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDStatusPagesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List status pages that are attached to an incident - IncidentsStatusPageEntityPaginated *shared.IncidentsStatusPageEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDStatusPagesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDStatusPagesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDStatusPagesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDStatusPagesResponse) GetIncidentsStatusPageEntityPaginated() *shared.IncidentsStatusPageEntityPaginated { - if o == nil { - return nil - } - return o.IncidentsStatusPageEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidtasks.go b/internal/sdk/models/operations/getv1incidentsincidentidtasks.go deleted file mode 100644 index b94bfe7..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidtasks.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDTasksRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDTasksRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IncidentsIncidentIDTasksRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1IncidentsIncidentIDTasksRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDTasksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a list of all tasks for a specific incident - TaskEntityPaginated *shared.TaskEntityPaginated -} - -func (o *GetV1IncidentsIncidentIDTasksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDTasksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDTasksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDTasksResponse) GetTaskEntityPaginated() *shared.TaskEntityPaginated { - if o == nil { - return nil - } - return o.TaskEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidtaskstaskid.go b/internal/sdk/models/operations/getv1incidentsincidentidtaskstaskid.go deleted file mode 100644 index 22680b2..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidtaskstaskid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IncidentsIncidentIDTasksTaskIDRequest struct { - TaskID string `pathParam:"style=simple,explode=false,name=task_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *GetV1IncidentsIncidentIDTasksTaskIDRequest) GetTaskID() string { - if o == nil { - return "" - } - return o.TaskID -} - -func (o *GetV1IncidentsIncidentIDTasksTaskIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDTasksTaskIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IncidentsIncidentIDTasksTaskIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDTasksTaskIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDTasksTaskIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidtranscript.go b/internal/sdk/models/operations/getv1incidentsincidentidtranscript.go deleted file mode 100644 index 25993b3..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidtranscript.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// Sort - The order to sort the transcript entries. -type Sort string - -const ( - SortAsc Sort = "asc" - SortDesc Sort = "desc" -) - -func (e Sort) ToPointer() *Sort { - return &e -} -func (e *Sort) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "asc": - fallthrough - case "desc": - *e = Sort(v) - return nil - default: - return fmt.Errorf("invalid value for Sort: %v", v) - } -} - -type GetV1IncidentsIncidentIDTranscriptRequest struct { - // The ID of the transcript entry to start after. - After *string `queryParam:"style=form,explode=true,name=after"` - // The ID of the transcript entry to start before. - Before *string `queryParam:"style=form,explode=true,name=before"` - // The order to sort the transcript entries. - Sort *Sort `default:"asc" queryParam:"style=form,explode=true,name=sort"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (g GetV1IncidentsIncidentIDTranscriptRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1IncidentsIncidentIDTranscriptRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1IncidentsIncidentIDTranscriptRequest) GetAfter() *string { - if o == nil { - return nil - } - return o.After -} - -func (o *GetV1IncidentsIncidentIDTranscriptRequest) GetBefore() *string { - if o == nil { - return nil - } - return o.Before -} - -func (o *GetV1IncidentsIncidentIDTranscriptRequest) GetSort() *Sort { - if o == nil { - return nil - } - return o.Sort -} - -func (o *GetV1IncidentsIncidentIDTranscriptRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type GetV1IncidentsIncidentIDTranscriptResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve the transcript for a specific incident - PublicAPIV1IncidentsTranscriptEntity *shared.PublicAPIV1IncidentsTranscriptEntity -} - -func (o *GetV1IncidentsIncidentIDTranscriptResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDTranscriptResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDTranscriptResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDTranscriptResponse) GetPublicAPIV1IncidentsTranscriptEntity() *shared.PublicAPIV1IncidentsTranscriptEntity { - if o == nil { - return nil - } - return o.PublicAPIV1IncidentsTranscriptEntity -} diff --git a/internal/sdk/models/operations/getv1incidentsincidentidusersuserid.go b/internal/sdk/models/operations/getv1incidentsincidentidusersuserid.go deleted file mode 100644 index 910472d..0000000 --- a/internal/sdk/models/operations/getv1incidentsincidentidusersuserid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentsIncidentIDUsersUserIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - UserID string `pathParam:"style=simple,explode=false,name=user_id"` -} - -func (o *GetV1IncidentsIncidentIDUsersUserIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *GetV1IncidentsIncidentIDUsersUserIDRequest) GetUserID() string { - if o == nil { - return "" - } - return o.UserID -} - -type GetV1IncidentsIncidentIDUsersUserIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a user with current roles for an incident - IncidentsRoleAssignmentEntity *shared.IncidentsRoleAssignmentEntity -} - -func (o *GetV1IncidentsIncidentIDUsersUserIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentsIncidentIDUsersUserIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentsIncidentIDUsersUserIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentsIncidentIDUsersUserIDResponse) GetIncidentsRoleAssignmentEntity() *shared.IncidentsRoleAssignmentEntity { - if o == nil { - return nil - } - return o.IncidentsRoleAssignmentEntity -} diff --git a/internal/sdk/models/operations/getv1incidenttags.go b/internal/sdk/models/operations/getv1incidenttags.go deleted file mode 100644 index 3203213..0000000 --- a/internal/sdk/models/operations/getv1incidenttags.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentTagsRequest struct { - Prefix *string `queryParam:"style=form,explode=true,name=prefix"` -} - -func (o *GetV1IncidentTagsRequest) GetPrefix() *string { - if o == nil { - return nil - } - return o.Prefix -} - -type GetV1IncidentTagsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the incident tags in the organization - TagEntityPaginated *shared.TagEntityPaginated -} - -func (o *GetV1IncidentTagsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentTagsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentTagsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentTagsResponse) GetTagEntityPaginated() *shared.TagEntityPaginated { - if o == nil { - return nil - } - return o.TagEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidenttypes.go b/internal/sdk/models/operations/getv1incidenttypes.go deleted file mode 100644 index 9fe0a41..0000000 --- a/internal/sdk/models/operations/getv1incidenttypes.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentTypesRequest struct { - // A query to search incident types by their name - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1IncidentTypesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1IncidentTypesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IncidentTypesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1IncidentTypesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the incident types in the organization - IncidentTypeEntityPaginated *shared.IncidentTypeEntityPaginated -} - -func (o *GetV1IncidentTypesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentTypesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentTypesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentTypesResponse) GetIncidentTypeEntityPaginated() *shared.IncidentTypeEntityPaginated { - if o == nil { - return nil - } - return o.IncidentTypeEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1incidenttypesid.go b/internal/sdk/models/operations/getv1incidenttypesid.go deleted file mode 100644 index 44ca077..0000000 --- a/internal/sdk/models/operations/getv1incidenttypesid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IncidentTypesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1IncidentTypesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1IncidentTypesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single incident type from its ID - IncidentTypeEntity *shared.IncidentTypeEntity -} - -func (o *GetV1IncidentTypesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IncidentTypesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IncidentTypesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IncidentTypesIDResponse) GetIncidentTypeEntity() *shared.IncidentTypeEntity { - if o == nil { - return nil - } - return o.IncidentTypeEntity -} diff --git a/internal/sdk/models/operations/getv1infrastructures.go b/internal/sdk/models/operations/getv1infrastructures.go deleted file mode 100644 index 48498eb..0000000 --- a/internal/sdk/models/operations/getv1infrastructures.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1InfrastructuresRequest struct { - // A query to search infrastructures by their name - Query *string `queryParam:"style=form,explode=true,name=query"` - // Omit for any infrastructure that is added to an incident using the format "incident/{incident_id}" - OmitFor *string `queryParam:"style=form,explode=true,name=omit_for"` - // Restrict infrastructure search to given type. - Type *string `queryParam:"style=form,explode=true,name=type"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1InfrastructuresRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1InfrastructuresRequest) GetOmitFor() *string { - if o == nil { - return nil - } - return o.OmitFor -} - -func (o *GetV1InfrastructuresRequest) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *GetV1InfrastructuresRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1InfrastructuresRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1InfrastructuresResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists functionality, service and environment objects - InfrastructureSearchEntity *shared.InfrastructureSearchEntity -} - -func (o *GetV1InfrastructuresResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1InfrastructuresResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1InfrastructuresResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1InfrastructuresResponse) GetInfrastructureSearchEntity() *shared.InfrastructureSearchEntity { - if o == nil { - return nil - } - return o.InfrastructureSearchEntity -} diff --git a/internal/sdk/models/operations/getv1integrations.go b/internal/sdk/models/operations/getv1integrations.go deleted file mode 100644 index bc89971..0000000 --- a/internal/sdk/models/operations/getv1integrations.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationsawscloudtrailbatches.go b/internal/sdk/models/operations/getv1integrationsawscloudtrailbatches.go deleted file mode 100644 index 44ccc99..0000000 --- a/internal/sdk/models/operations/getv1integrationsawscloudtrailbatches.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsAwsCloudtrailBatchesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // AWS connection ID - ConnectionID *string `queryParam:"style=form,explode=true,name=connection_id"` -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesRequest) GetConnectionID() *string { - if o == nil { - return nil - } - return o.ConnectionID -} - -type GetV1IntegrationsAwsCloudtrailBatchesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists CloudTrail batches for the authenticated organization. - IntegrationsAwsCloudtrailBatchEntityPaginated *shared.IntegrationsAwsCloudtrailBatchEntityPaginated -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesResponse) GetIntegrationsAwsCloudtrailBatchEntityPaginated() *shared.IntegrationsAwsCloudtrailBatchEntityPaginated { - if o == nil { - return nil - } - return o.IntegrationsAwsCloudtrailBatchEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1integrationsawscloudtrailbatchesid.go b/internal/sdk/models/operations/getv1integrationsawscloudtrailbatchesid.go deleted file mode 100644 index 7c0fabd..0000000 --- a/internal/sdk/models/operations/getv1integrationsawscloudtrailbatchesid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsAwsCloudtrailBatchesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1IntegrationsAwsCloudtrailBatchesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single CloudTrail batch. - IntegrationsAwsCloudtrailBatchEntity *shared.IntegrationsAwsCloudtrailBatchEntity -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDResponse) GetIntegrationsAwsCloudtrailBatchEntity() *shared.IntegrationsAwsCloudtrailBatchEntity { - if o == nil { - return nil - } - return o.IntegrationsAwsCloudtrailBatchEntity -} diff --git a/internal/sdk/models/operations/getv1integrationsawscloudtrailbatchesidevents.go b/internal/sdk/models/operations/getv1integrationsawscloudtrailbatchesidevents.go deleted file mode 100644 index 5978c98..0000000 --- a/internal/sdk/models/operations/getv1integrationsawscloudtrailbatchesidevents.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsAwsCloudtrailBatchesIDEventsRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDEventsRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1IntegrationsAwsCloudtrailBatchesIDEventsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDEventsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDEventsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsAwsCloudtrailBatchesIDEventsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationsawsconnections.go b/internal/sdk/models/operations/getv1integrationsawsconnections.go deleted file mode 100644 index 3633b8a..0000000 --- a/internal/sdk/models/operations/getv1integrationsawsconnections.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsAwsConnectionsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // AWS account ID containing the role to be assumed - AwsAccountID *string `queryParam:"style=form,explode=true,name=aws_account_id"` - // ARN of the role to be assumed - TargetArn *string `queryParam:"style=form,explode=true,name=target_arn"` - // The external ID supplied when assuming the role - ExternalID *string `queryParam:"style=form,explode=true,name=external_id"` -} - -func (o *GetV1IntegrationsAwsConnectionsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IntegrationsAwsConnectionsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1IntegrationsAwsConnectionsRequest) GetAwsAccountID() *string { - if o == nil { - return nil - } - return o.AwsAccountID -} - -func (o *GetV1IntegrationsAwsConnectionsRequest) GetTargetArn() *string { - if o == nil { - return nil - } - return o.TargetArn -} - -func (o *GetV1IntegrationsAwsConnectionsRequest) GetExternalID() *string { - if o == nil { - return nil - } - return o.ExternalID -} - -type GetV1IntegrationsAwsConnectionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists the available and configured AWS integration connections for the authenticated organization. - IntegrationsAwsConnectionEntityPaginated *shared.IntegrationsAwsConnectionEntityPaginated -} - -func (o *GetV1IntegrationsAwsConnectionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsAwsConnectionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsAwsConnectionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsAwsConnectionsResponse) GetIntegrationsAwsConnectionEntityPaginated() *shared.IntegrationsAwsConnectionEntityPaginated { - if o == nil { - return nil - } - return o.IntegrationsAwsConnectionEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1integrationsawsconnectionsid.go b/internal/sdk/models/operations/getv1integrationsawsconnectionsid.go deleted file mode 100644 index b25e247..0000000 --- a/internal/sdk/models/operations/getv1integrationsawsconnectionsid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsAwsConnectionsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1IntegrationsAwsConnectionsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1IntegrationsAwsConnectionsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves the information about the AWS connection. - IntegrationsAwsConnectionEntity *shared.IntegrationsAwsConnectionEntity -} - -func (o *GetV1IntegrationsAwsConnectionsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsAwsConnectionsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsAwsConnectionsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsAwsConnectionsIDResponse) GetIntegrationsAwsConnectionEntity() *shared.IntegrationsAwsConnectionEntity { - if o == nil { - return nil - } - return o.IntegrationsAwsConnectionEntity -} diff --git a/internal/sdk/models/operations/getv1integrationsconfluencecloudconnectionsidspacesearch.go b/internal/sdk/models/operations/getv1integrationsconfluencecloudconnectionsidspacesearch.go deleted file mode 100644 index f4438ba..0000000 --- a/internal/sdk/models/operations/getv1integrationsconfluencecloudconnectionsidspacesearch.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - // Space Key - Keyword *string `queryParam:"style=form,explode=true,name=keyword"` -} - -func (o *GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchRequest) GetKeyword() *string { - if o == nil { - return nil - } - return o.Keyword -} - -type GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists available space keys for the Confluence integration connection. - IntegrationsConfluenceCloudSpaceKeyEntity *shared.IntegrationsConfluenceCloudSpaceKeyEntity -} - -func (o *GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsConfluenceCloudConnectionsIDSpaceSearchResponse) GetIntegrationsConfluenceCloudSpaceKeyEntity() *shared.IntegrationsConfluenceCloudSpaceKeyEntity { - if o == nil { - return nil - } - return o.IntegrationsConfluenceCloudSpaceKeyEntity -} diff --git a/internal/sdk/models/operations/getv1integrationsconnections.go b/internal/sdk/models/operations/getv1integrationsconnections.go deleted file mode 100644 index dc2c7a5..0000000 --- a/internal/sdk/models/operations/getv1integrationsconnections.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsConnectionsRequest struct { - // Only return installed integrations with the supplied slugs (types). - IntegrationSlug *string `queryParam:"style=form,explode=true,name=integration_slug"` -} - -func (o *GetV1IntegrationsConnectionsRequest) GetIntegrationSlug() *string { - if o == nil { - return nil - } - return o.IntegrationSlug -} - -type GetV1IntegrationsConnectionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsConnectionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsConnectionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsConnectionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationsfieldmapsfieldmapidavailablefields.go b/internal/sdk/models/operations/getv1integrationsfieldmapsfieldmapidavailablefields.go deleted file mode 100644 index a1bea84..0000000 --- a/internal/sdk/models/operations/getv1integrationsfieldmapsfieldmapidavailablefields.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsRequest struct { - FieldMapID string `pathParam:"style=simple,explode=false,name=field_map_id"` -} - -func (o *GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsRequest) GetFieldMapID() string { - if o == nil { - return "" - } - return o.FieldMapID -} - -type GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Get a description of the fields to which data can be mapped - FieldMappingMappableFieldEntity *shared.FieldMappingMappableFieldEntity -} - -func (o *GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsFieldMapsFieldMapIDAvailableFieldsResponse) GetFieldMappingMappableFieldEntity() *shared.FieldMappingMappableFieldEntity { - if o == nil { - return nil - } - return o.FieldMappingMappableFieldEntity -} diff --git a/internal/sdk/models/operations/getv1integrationsintegrationid.go b/internal/sdk/models/operations/getv1integrationsintegrationid.go deleted file mode 100644 index f7a4032..0000000 --- a/internal/sdk/models/operations/getv1integrationsintegrationid.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsIntegrationIDRequest struct { - // Integration UUID - IntegrationID string `pathParam:"style=simple,explode=false,name=integration_id"` -} - -func (o *GetV1IntegrationsIntegrationIDRequest) GetIntegrationID() string { - if o == nil { - return "" - } - return o.IntegrationID -} - -type GetV1IntegrationsIntegrationIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single integration - IntegrationsIntegrationEntity *shared.IntegrationsIntegrationEntity -} - -func (o *GetV1IntegrationsIntegrationIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsIntegrationIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsIntegrationIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsIntegrationIDResponse) GetIntegrationsIntegrationEntity() *shared.IntegrationsIntegrationEntity { - if o == nil { - return nil - } - return o.IntegrationsIntegrationEntity -} diff --git a/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidemojiactions.go b/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidemojiactions.go deleted file mode 100644 index a459b1c..0000000 --- a/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidemojiactions.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest struct { - // Slack Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go b/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go deleted file mode 100644 index 63193f7..0000000 --- a/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest struct { - // Slack Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` - EmojiActionID string `pathParam:"style=simple,explode=false,name=emoji_action_id"` -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest) GetEmojiActionID() string { - if o == nil { - return "" - } - return o.EmojiActionID -} - -type GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidworkspaces.go b/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidworkspaces.go deleted file mode 100644 index 55b3b88..0000000 --- a/internal/sdk/models/operations/getv1integrationsslackconnectionsconnectionidworkspaces.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesRequest struct { - // Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -type GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsSlackConnectionsConnectionIDWorkspacesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationsslackusergroups.go b/internal/sdk/models/operations/getv1integrationsslackusergroups.go deleted file mode 100644 index 1a5e89f..0000000 --- a/internal/sdk/models/operations/getv1integrationsslackusergroups.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsSlackUsergroupsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsSlackUsergroupsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsSlackUsergroupsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsSlackUsergroupsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationsstatusesslug.go b/internal/sdk/models/operations/getv1integrationsstatusesslug.go deleted file mode 100644 index 2570aea..0000000 --- a/internal/sdk/models/operations/getv1integrationsstatusesslug.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsStatusesSlugRequest struct { - Slug string `pathParam:"style=simple,explode=false,name=slug"` -} - -func (o *GetV1IntegrationsStatusesSlugRequest) GetSlug() string { - if o == nil { - return "" - } - return o.Slug -} - -type GetV1IntegrationsStatusesSlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsStatusesSlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsStatusesSlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsStatusesSlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationsstatuspageconnections.go b/internal/sdk/models/operations/getv1integrationsstatuspageconnections.go deleted file mode 100644 index 1cb42fb..0000000 --- a/internal/sdk/models/operations/getv1integrationsstatuspageconnections.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsStatuspageConnectionsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1IntegrationsStatuspageConnectionsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1IntegrationsStatuspageConnectionsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1IntegrationsStatuspageConnectionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists the available and configured Statuspage integrations connections for the authenticated organization. - IntegrationsStatuspageConnectionEntityPaginated *shared.IntegrationsStatuspageConnectionEntityPaginated -} - -func (o *GetV1IntegrationsStatuspageConnectionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsStatuspageConnectionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsStatuspageConnectionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsStatuspageConnectionsResponse) GetIntegrationsStatuspageConnectionEntityPaginated() *shared.IntegrationsStatuspageConnectionEntityPaginated { - if o == nil { - return nil - } - return o.IntegrationsStatuspageConnectionEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1integrationsstatuspageconnectionsconnectionid.go b/internal/sdk/models/operations/getv1integrationsstatuspageconnectionsconnectionid.go deleted file mode 100644 index ba20b35..0000000 --- a/internal/sdk/models/operations/getv1integrationsstatuspageconnectionsconnectionid.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1IntegrationsStatuspageConnectionsConnectionIDRequest struct { - // Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -type GetV1IntegrationsStatuspageConnectionsConnectionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve the information about the Statuspage connection. - IntegrationsStatuspageConnectionEntity *shared.IntegrationsStatuspageConnectionEntity -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetIntegrationsStatuspageConnectionEntity() *shared.IntegrationsStatuspageConnectionEntity { - if o == nil { - return nil - } - return o.IntegrationsStatuspageConnectionEntity -} diff --git a/internal/sdk/models/operations/getv1integrationsstatuspageconnectionsconnectionidpages.go b/internal/sdk/models/operations/getv1integrationsstatuspageconnectionsconnectionidpages.go deleted file mode 100644 index a45c1cb..0000000 --- a/internal/sdk/models/operations/getv1integrationsstatuspageconnectionsconnectionidpages.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsStatuspageConnectionsConnectionIDPagesRequest struct { - // Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDPagesRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -type GetV1IntegrationsStatuspageConnectionsConnectionIDPagesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDPagesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDPagesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsStatuspageConnectionsConnectionIDPagesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1integrationszendesksearch.go b/internal/sdk/models/operations/getv1integrationszendesksearch.go deleted file mode 100644 index dec9e65..0000000 --- a/internal/sdk/models/operations/getv1integrationszendesksearch.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1IntegrationsZendeskSearchRequest struct { - // Zendesk ticket ID - TicketID string `queryParam:"style=form,explode=true,name=ticket_id"` - // Use to include attached_incidents - Include *string `queryParam:"style=form,explode=true,name=include"` -} - -func (o *GetV1IntegrationsZendeskSearchRequest) GetTicketID() string { - if o == nil { - return "" - } - return o.TicketID -} - -func (o *GetV1IntegrationsZendeskSearchRequest) GetInclude() *string { - if o == nil { - return nil - } - return o.Include -} - -type GetV1IntegrationsZendeskSearchResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1IntegrationsZendeskSearchResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1IntegrationsZendeskSearchResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1IntegrationsZendeskSearchResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1lifecyclesmeasurementdefinitions.go b/internal/sdk/models/operations/getv1lifecyclesmeasurementdefinitions.go deleted file mode 100644 index faac27e..0000000 --- a/internal/sdk/models/operations/getv1lifecyclesmeasurementdefinitions.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1LifecyclesMeasurementDefinitionsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1LifecyclesMeasurementDefinitionsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1LifecyclesMeasurementDefinitionsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1LifecyclesMeasurementDefinitionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1LifecyclesMeasurementDefinitionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1LifecyclesMeasurementDefinitionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1LifecyclesMeasurementDefinitionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go b/internal/sdk/models/operations/getv1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go deleted file mode 100644 index 037d7b1..0000000 --- a/internal/sdk/models/operations/getv1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest struct { - MeasurementDefinitionID string `pathParam:"style=simple,explode=false,name=measurement_definition_id"` -} - -func (o *GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest) GetMeasurementDefinitionID() string { - if o == nil { - return "" - } - return o.MeasurementDefinitionID -} - -type GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1lifecyclesphases.go b/internal/sdk/models/operations/getv1lifecyclesphases.go deleted file mode 100644 index 9c15f96..0000000 --- a/internal/sdk/models/operations/getv1lifecyclesphases.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1LifecyclesPhasesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the lifecycle phases and milestones in the organization - LifecyclesPhaseEntityList *shared.LifecyclesPhaseEntityList -} - -func (o *GetV1LifecyclesPhasesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1LifecyclesPhasesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1LifecyclesPhasesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1LifecyclesPhasesResponse) GetLifecyclesPhaseEntityList() *shared.LifecyclesPhaseEntityList { - if o == nil { - return nil - } - return o.LifecyclesPhaseEntityList -} diff --git a/internal/sdk/models/operations/getv1metricsincidents.go b/internal/sdk/models/operations/getv1metricsincidents.go deleted file mode 100644 index 5877de2..0000000 --- a/internal/sdk/models/operations/getv1metricsincidents.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" -) - -type BucketSize string - -const ( - BucketSizeWeek BucketSize = "week" - BucketSizeDay BucketSize = "day" - BucketSizeMonth BucketSize = "month" - BucketSizeAllTime BucketSize = "all_time" -) - -func (e BucketSize) ToPointer() *BucketSize { - return &e -} -func (e *BucketSize) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "week": - fallthrough - case "day": - fallthrough - case "month": - fallthrough - case "all_time": - *e = BucketSize(v) - return nil - default: - return fmt.Errorf("invalid value for BucketSize: %v", v) - } -} - -type By string - -const ( - ByTotal By = "total" - BySeverity By = "severity" - ByPriority By = "priority" - ByFunctionality By = "functionality" - ByService By = "service" - ByEnvironment By = "environment" - ByUser By = "user" - ByUserInvolvement By = "user_involvement" -) - -func (e By) ToPointer() *By { - return &e -} -func (e *By) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "total": - fallthrough - case "severity": - fallthrough - case "priority": - fallthrough - case "functionality": - fallthrough - case "service": - fallthrough - case "environment": - fallthrough - case "user": - fallthrough - case "user_involvement": - *e = By(v) - return nil - default: - return fmt.Errorf("invalid value for By: %v", v) - } -} - -type QueryParamSortField string - -const ( - QueryParamSortFieldMttd QueryParamSortField = "mttd" - QueryParamSortFieldMtta QueryParamSortField = "mtta" - QueryParamSortFieldMttm QueryParamSortField = "mttm" - QueryParamSortFieldMttr QueryParamSortField = "mttr" - QueryParamSortFieldCount QueryParamSortField = "count" - QueryParamSortFieldTotalTime QueryParamSortField = "total_time" -) - -func (e QueryParamSortField) ToPointer() *QueryParamSortField { - return &e -} -func (e *QueryParamSortField) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "mttd": - fallthrough - case "mtta": - fallthrough - case "mttm": - fallthrough - case "mttr": - fallthrough - case "count": - fallthrough - case "total_time": - *e = QueryParamSortField(v) - return nil - default: - return fmt.Errorf("invalid value for QueryParamSortField: %v", v) - } -} - -type QueryParamSortDirection string - -const ( - QueryParamSortDirectionAsc QueryParamSortDirection = "asc" - QueryParamSortDirectionDesc QueryParamSortDirection = "desc" -) - -func (e QueryParamSortDirection) ToPointer() *QueryParamSortDirection { - return &e -} -func (e *QueryParamSortDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "asc": - fallthrough - case "desc": - *e = QueryParamSortDirection(v) - return nil - default: - return fmt.Errorf("invalid value for QueryParamSortDirection: %v", v) - } -} - -type GetV1MetricsIncidentsRequest struct { - // The start date to return metrics from - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return metrics from - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` - BucketSize *BucketSize `queryParam:"style=form,explode=true,name=bucket_size"` - By *By `queryParam:"style=form,explode=true,name=by"` - SortField *QueryParamSortField `queryParam:"style=form,explode=true,name=sort_field"` - SortDirection *QueryParamSortDirection `queryParam:"style=form,explode=true,name=sort_direction"` - SortLimit *int `queryParam:"style=form,explode=true,name=sort_limit"` - Conditions *string `queryParam:"style=form,explode=true,name=conditions"` -} - -func (g GetV1MetricsIncidentsRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1MetricsIncidentsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1MetricsIncidentsRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1MetricsIncidentsRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -func (o *GetV1MetricsIncidentsRequest) GetBucketSize() *BucketSize { - if o == nil { - return nil - } - return o.BucketSize -} - -func (o *GetV1MetricsIncidentsRequest) GetBy() *By { - if o == nil { - return nil - } - return o.By -} - -func (o *GetV1MetricsIncidentsRequest) GetSortField() *QueryParamSortField { - if o == nil { - return nil - } - return o.SortField -} - -func (o *GetV1MetricsIncidentsRequest) GetSortDirection() *QueryParamSortDirection { - if o == nil { - return nil - } - return o.SortDirection -} - -func (o *GetV1MetricsIncidentsRequest) GetSortLimit() *int { - if o == nil { - return nil - } - return o.SortLimit -} - -func (o *GetV1MetricsIncidentsRequest) GetConditions() *string { - if o == nil { - return nil - } - return o.Conditions -} - -type GetV1MetricsIncidentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns a report with time bucketed analytics data - MetricsMetricsEntity *shared.MetricsMetricsEntity -} - -func (o *GetV1MetricsIncidentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1MetricsIncidentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1MetricsIncidentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1MetricsIncidentsResponse) GetMetricsMetricsEntity() *shared.MetricsMetricsEntity { - if o == nil { - return nil - } - return o.MetricsMetricsEntity -} diff --git a/internal/sdk/models/operations/getv1metricsinfratype.go b/internal/sdk/models/operations/getv1metricsinfratype.go deleted file mode 100644 index 846b76a..0000000 --- a/internal/sdk/models/operations/getv1metricsinfratype.go +++ /dev/null @@ -1,123 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" -) - -type InfraType string - -const ( - InfraTypeEnvironments InfraType = "environments" - InfraTypeFunctionalities InfraType = "functionalities" - InfraTypeServices InfraType = "services" - InfraTypeCustomers InfraType = "customers" -) - -func (e InfraType) ToPointer() *InfraType { - return &e -} -func (e *InfraType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "environments": - fallthrough - case "functionalities": - fallthrough - case "services": - fallthrough - case "customers": - *e = InfraType(v) - return nil - default: - return fmt.Errorf("invalid value for InfraType: %v", v) - } -} - -type GetV1MetricsInfraTypeRequest struct { - InfraType InfraType `pathParam:"style=simple,explode=false,name=infra_type"` - // The start date to return metrics from; defaults to 30 days ago - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return metrics from, defaults to today - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` -} - -func (g GetV1MetricsInfraTypeRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1MetricsInfraTypeRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1MetricsInfraTypeRequest) GetInfraType() InfraType { - if o == nil { - return InfraType("") - } - return o.InfraType -} - -func (o *GetV1MetricsInfraTypeRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1MetricsInfraTypeRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -type GetV1MetricsInfraTypeResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns metrics for all components of a given type - MetricsInfrastructureListEntity *shared.MetricsInfrastructureListEntity -} - -func (o *GetV1MetricsInfraTypeResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1MetricsInfraTypeResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1MetricsInfraTypeResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1MetricsInfraTypeResponse) GetMetricsInfrastructureListEntity() *shared.MetricsInfrastructureListEntity { - if o == nil { - return nil - } - return o.MetricsInfrastructureListEntity -} diff --git a/internal/sdk/models/operations/getv1metricsinfratypeinfraid.go b/internal/sdk/models/operations/getv1metricsinfratypeinfraid.go deleted file mode 100644 index 0190abe..0000000 --- a/internal/sdk/models/operations/getv1metricsinfratypeinfraid.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" -) - -type PathParamInfraType string - -const ( - PathParamInfraTypeEnvironments PathParamInfraType = "environments" - PathParamInfraTypeFunctionalities PathParamInfraType = "functionalities" - PathParamInfraTypeServices PathParamInfraType = "services" - PathParamInfraTypeCustomers PathParamInfraType = "customers" -) - -func (e PathParamInfraType) ToPointer() *PathParamInfraType { - return &e -} -func (e *PathParamInfraType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "environments": - fallthrough - case "functionalities": - fallthrough - case "services": - fallthrough - case "customers": - *e = PathParamInfraType(v) - return nil - default: - return fmt.Errorf("invalid value for PathParamInfraType: %v", v) - } -} - -type GetV1MetricsInfraTypeInfraIDRequest struct { - InfraType PathParamInfraType `pathParam:"style=simple,explode=false,name=infra_type"` - // Component UUID - InfraID string `pathParam:"style=simple,explode=false,name=infra_id"` - // The start date to return metrics from; defaults to 30 days ago - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return metrics from, defaults to today - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` -} - -func (g GetV1MetricsInfraTypeInfraIDRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1MetricsInfraTypeInfraIDRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1MetricsInfraTypeInfraIDRequest) GetInfraType() PathParamInfraType { - if o == nil { - return PathParamInfraType("") - } - return o.InfraType -} - -func (o *GetV1MetricsInfraTypeInfraIDRequest) GetInfraID() string { - if o == nil { - return "" - } - return o.InfraID -} - -func (o *GetV1MetricsInfraTypeInfraIDRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1MetricsInfraTypeInfraIDRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -type GetV1MetricsInfraTypeInfraIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Return metrics for a specific component - MetricsInfrastructureMetricsEntity *shared.MetricsInfrastructureMetricsEntity -} - -func (o *GetV1MetricsInfraTypeInfraIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1MetricsInfraTypeInfraIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1MetricsInfraTypeInfraIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1MetricsInfraTypeInfraIDResponse) GetMetricsInfrastructureMetricsEntity() *shared.MetricsInfrastructureMetricsEntity { - if o == nil { - return nil - } - return o.MetricsInfrastructureMetricsEntity -} diff --git a/internal/sdk/models/operations/getv1metricsmilestonefunnel.go b/internal/sdk/models/operations/getv1metricsmilestonefunnel.go deleted file mode 100644 index a7051a7..0000000 --- a/internal/sdk/models/operations/getv1metricsmilestonefunnel.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" - "time" -) - -// GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy - A matching strategy for the tags provided -type GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy string - -const ( - GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategyAny GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy = "any" - GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategyMatchAll GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy = "match_all" - GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategyExclude GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy = "exclude" -) - -func (e GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy) ToPointer() *GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy { - return &e -} -func (e *GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "any": - fallthrough - case "match_all": - fallthrough - case "exclude": - *e = GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy: %v", v) - } -} - -type GetV1MetricsMilestoneFunnelRequest struct { - // A JSON string that defines 'logic' and 'user_data' - Conditions *string `queryParam:"style=form,explode=true,name=conditions"` - // A comma separated list of environment IDs or 'is_empty' to filter for incidents with no impacted environments - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of service IDs or 'is_empty' to filter for incidents with no impacted services - Services *string `queryParam:"style=form,explode=true,name=services"` - // A comma separated list of functionality IDs or 'is_empty' to filter for incidents with no impacted functionalities - Functionalities *string `queryParam:"style=form,explode=true,name=functionalities"` - // A comma separated list of infrastructure IDs. Returns incidents that do not have the following infrastructure ids associated with them. - ExcludedInfrastructureIds *string `queryParam:"style=form,explode=true,name=excluded_infrastructure_ids"` - // A comma separated list of team IDs - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of IDs for assigned teams or 'is_empty' to filter for incidents with no active team assignments - AssignedTeams *string `queryParam:"style=form,explode=true,name=assigned_teams"` - // Incident status - Status *string `queryParam:"style=form,explode=true,name=status"` - // Filters for incidents that started on or after this date - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // Filters for incidents that started on or before this date - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` - // Filters for incidents that were resolved at or after this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active. - ResolvedAtOrAfter *time.Time `queryParam:"style=form,explode=true,name=resolved_at_or_after"` - // Filters for incidents that were resolved at or before this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active. - ResolvedAtOrBefore *time.Time `queryParam:"style=form,explode=true,name=resolved_at_or_before"` - // Filters for incidents that were created at or after this time - CreatedAtOrAfter *time.Time `queryParam:"style=form,explode=true,name=created_at_or_after"` - // Filters for incidents that were created at or before this time - CreatedAtOrBefore *time.Time `queryParam:"style=form,explode=true,name=created_at_or_before"` - // A text query for an incident that searches on name, summary, and desciption - Query *string `queryParam:"style=form,explode=true,name=query"` - // A query to search incidents by their name - Name *string `queryParam:"style=form,explode=true,name=name"` - // The id of a previously saved search. - SavedSearchID *string `queryParam:"style=form,explode=true,name=saved_search_id"` - // A text value of priority - Priorities *string `queryParam:"style=form,explode=true,name=priorities"` - // Flag for including incidents where priority has not been set - PriorityNotSet *bool `queryParam:"style=form,explode=true,name=priority_not_set"` - // A text value of severity - Severities *string `queryParam:"style=form,explode=true,name=severities"` - // Flag for including incidents where severity has not been set - SeverityNotSet *bool `queryParam:"style=form,explode=true,name=severity_not_set"` - // A comma separated list of current milestones - CurrentMilestones *string `queryParam:"style=form,explode=true,name=current_milestones"` - // A comma separated list of tags - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // A matching strategy for the tags provided - TagMatchStrategy *GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy `queryParam:"style=form,explode=true,name=tag_match_strategy"` - // Return archived incidents - Archived *bool `queryParam:"style=form,explode=true,name=archived"` - // Filters for incidents that were updated after this date - UpdatedAfter *time.Time `queryParam:"style=form,explode=true,name=updated_after"` - // Filters for incidents that were updated before this date - UpdatedBefore *time.Time `queryParam:"style=form,explode=true,name=updated_before"` - // A comma separated list of incident type IDs - IncidentTypeID *string `queryParam:"style=form,explode=true,name=incident_type_id"` - GetV1MetricsTicketFunnel *shared.GetV1MetricsTicketFunnel `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (g GetV1MetricsMilestoneFunnelRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1MetricsMilestoneFunnelRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetConditions() *string { - if o == nil { - return nil - } - return o.Conditions -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetFunctionalities() *string { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetExcludedInfrastructureIds() *string { - if o == nil { - return nil - } - return o.ExcludedInfrastructureIds -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetAssignedTeams() *string { - if o == nil { - return nil - } - return o.AssignedTeams -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetResolvedAtOrAfter() *time.Time { - if o == nil { - return nil - } - return o.ResolvedAtOrAfter -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetResolvedAtOrBefore() *time.Time { - if o == nil { - return nil - } - return o.ResolvedAtOrBefore -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetCreatedAtOrAfter() *time.Time { - if o == nil { - return nil - } - return o.CreatedAtOrAfter -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetCreatedAtOrBefore() *time.Time { - if o == nil { - return nil - } - return o.CreatedAtOrBefore -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetSavedSearchID() *string { - if o == nil { - return nil - } - return o.SavedSearchID -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetPriorities() *string { - if o == nil { - return nil - } - return o.Priorities -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetPriorityNotSet() *bool { - if o == nil { - return nil - } - return o.PriorityNotSet -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetSeverities() *string { - if o == nil { - return nil - } - return o.Severities -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetSeverityNotSet() *bool { - if o == nil { - return nil - } - return o.SeverityNotSet -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetCurrentMilestones() *string { - if o == nil { - return nil - } - return o.CurrentMilestones -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetTagMatchStrategy() *GetV1MetricsMilestoneFunnelQueryParamTagMatchStrategy { - if o == nil { - return nil - } - return o.TagMatchStrategy -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetArchived() *bool { - if o == nil { - return nil - } - return o.Archived -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetUpdatedAfter() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAfter -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetUpdatedBefore() *time.Time { - if o == nil { - return nil - } - return o.UpdatedBefore -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetIncidentTypeID() *string { - if o == nil { - return nil - } - return o.IncidentTypeID -} - -func (o *GetV1MetricsMilestoneFunnelRequest) GetGetV1MetricsTicketFunnel() *shared.GetV1MetricsTicketFunnel { - if o == nil { - return nil - } - return o.GetV1MetricsTicketFunnel -} - -type GetV1MetricsMilestoneFunnelResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns a report with time bucketed milestone data - MetricsMilestonesFunnelEntity *shared.MetricsMilestonesFunnelEntity -} - -func (o *GetV1MetricsMilestoneFunnelResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1MetricsMilestoneFunnelResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1MetricsMilestoneFunnelResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1MetricsMilestoneFunnelResponse) GetMetricsMilestonesFunnelEntity() *shared.MetricsMilestonesFunnelEntity { - if o == nil { - return nil - } - return o.MetricsMilestonesFunnelEntity -} diff --git a/internal/sdk/models/operations/getv1metricsmttx.go b/internal/sdk/models/operations/getv1metricsmttx.go deleted file mode 100644 index 4eec63c..0000000 --- a/internal/sdk/models/operations/getv1metricsmttx.go +++ /dev/null @@ -1,514 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" - "time" -) - -// GetV1MetricsMttxQueryParamTagMatchStrategy - A matching strategy for the tags provided -type GetV1MetricsMttxQueryParamTagMatchStrategy string - -const ( - GetV1MetricsMttxQueryParamTagMatchStrategyAny GetV1MetricsMttxQueryParamTagMatchStrategy = "any" - GetV1MetricsMttxQueryParamTagMatchStrategyMatchAll GetV1MetricsMttxQueryParamTagMatchStrategy = "match_all" - GetV1MetricsMttxQueryParamTagMatchStrategyExclude GetV1MetricsMttxQueryParamTagMatchStrategy = "exclude" -) - -func (e GetV1MetricsMttxQueryParamTagMatchStrategy) ToPointer() *GetV1MetricsMttxQueryParamTagMatchStrategy { - return &e -} -func (e *GetV1MetricsMttxQueryParamTagMatchStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "any": - fallthrough - case "match_all": - fallthrough - case "exclude": - *e = GetV1MetricsMttxQueryParamTagMatchStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1MetricsMttxQueryParamTagMatchStrategy: %v", v) - } -} - -type SortBy string - -const ( - SortByCountAsc SortBy = "count_asc" - SortByMttrAsc SortBy = "mttr_asc" - SortByMttaAsc SortBy = "mtta_asc" - SortByMttdAsc SortBy = "mttd_asc" - SortByMttmAsc SortBy = "mttm_asc" - SortByHealthinessAsc SortBy = "healthiness_asc" - SortByCountDesc SortBy = "count_desc" - SortByMttrDesc SortBy = "mttr_desc" - SortByMttaDesc SortBy = "mtta_desc" - SortByMttdDesc SortBy = "mttd_desc" - SortByMttmDesc SortBy = "mttm_desc" - SortByHealthinessDesc SortBy = "healthiness_desc" -) - -func (e SortBy) ToPointer() *SortBy { - return &e -} -func (e *SortBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "count_asc": - fallthrough - case "mttr_asc": - fallthrough - case "mtta_asc": - fallthrough - case "mttd_asc": - fallthrough - case "mttm_asc": - fallthrough - case "healthiness_asc": - fallthrough - case "count_desc": - fallthrough - case "mttr_desc": - fallthrough - case "mtta_desc": - fallthrough - case "mttd_desc": - fallthrough - case "mttm_desc": - fallthrough - case "healthiness_desc": - *e = SortBy(v) - return nil - default: - return fmt.Errorf("invalid value for SortBy: %v", v) - } -} - -type GroupBy string - -const ( - GroupByServices GroupBy = "services" - GroupByEnvironments GroupBy = "environments" - GroupByFunctionalities GroupBy = "functionalities" - GroupByTeams GroupBy = "teams" - GroupBySeverities GroupBy = "severities" - GroupByUsers GroupBy = "users" - GroupByStartedDay GroupBy = "started_day" - GroupByStartedWeek GroupBy = "started_week" - GroupByStartedMonth GroupBy = "started_month" - GroupByCustomFields GroupBy = "custom_fields" -) - -func (e GroupBy) ToPointer() *GroupBy { - return &e -} -func (e *GroupBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "services": - fallthrough - case "environments": - fallthrough - case "functionalities": - fallthrough - case "teams": - fallthrough - case "severities": - fallthrough - case "users": - fallthrough - case "started_day": - fallthrough - case "started_week": - fallthrough - case "started_month": - fallthrough - case "custom_fields": - *e = GroupBy(v) - return nil - default: - return fmt.Errorf("invalid value for GroupBy: %v", v) - } -} - -type GetV1MetricsMttxRequestBody struct { - GroupBy []GroupBy `form:"name=group_by"` -} - -func (o *GetV1MetricsMttxRequestBody) GetGroupBy() []GroupBy { - if o == nil { - return nil - } - return o.GroupBy -} - -type GetV1MetricsMttxRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A JSON string that defines 'logic' and 'user_data' - Conditions *string `queryParam:"style=form,explode=true,name=conditions"` - // A comma separated list of environment IDs or 'is_empty' to filter for incidents with no impacted environments - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of service IDs or 'is_empty' to filter for incidents with no impacted services - Services *string `queryParam:"style=form,explode=true,name=services"` - // A comma separated list of functionality IDs or 'is_empty' to filter for incidents with no impacted functionalities - Functionalities *string `queryParam:"style=form,explode=true,name=functionalities"` - // A comma separated list of infrastructure IDs. Returns incidents that do not have the following infrastructure ids associated with them. - ExcludedInfrastructureIds *string `queryParam:"style=form,explode=true,name=excluded_infrastructure_ids"` - // A comma separated list of team IDs - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of IDs for assigned teams or 'is_empty' to filter for incidents with no active team assignments - AssignedTeams *string `queryParam:"style=form,explode=true,name=assigned_teams"` - // Incident status - Status *string `queryParam:"style=form,explode=true,name=status"` - // Filters for incidents that started on or after this date - StartDate types.Date `queryParam:"style=form,explode=true,name=start_date"` - // Filters for incidents that started on or before this date - EndDate types.Date `queryParam:"style=form,explode=true,name=end_date"` - // Filters for incidents that were resolved at or after this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active. - ResolvedAtOrAfter *time.Time `queryParam:"style=form,explode=true,name=resolved_at_or_after"` - // Filters for incidents that were resolved at or before this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active. - ResolvedAtOrBefore *time.Time `queryParam:"style=form,explode=true,name=resolved_at_or_before"` - // Filters for incidents that were created at or after this time - CreatedAtOrAfter *time.Time `queryParam:"style=form,explode=true,name=created_at_or_after"` - // Filters for incidents that were created at or before this time - CreatedAtOrBefore *time.Time `queryParam:"style=form,explode=true,name=created_at_or_before"` - // A text query for an incident that searches on name, summary, and desciption - Query *string `queryParam:"style=form,explode=true,name=query"` - // A query to search incidents by their name - Name *string `queryParam:"style=form,explode=true,name=name"` - // The id of a previously saved search. - SavedSearchID *string `queryParam:"style=form,explode=true,name=saved_search_id"` - // A text value of priority - Priorities *string `queryParam:"style=form,explode=true,name=priorities"` - // Flag for including incidents where priority has not been set - PriorityNotSet *bool `queryParam:"style=form,explode=true,name=priority_not_set"` - // A text value of severity - Severities *string `queryParam:"style=form,explode=true,name=severities"` - // Flag for including incidents where severity has not been set - SeverityNotSet *bool `queryParam:"style=form,explode=true,name=severity_not_set"` - // A comma separated list of current milestones - CurrentMilestones *string `queryParam:"style=form,explode=true,name=current_milestones"` - // A comma separated list of tags - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // A matching strategy for the tags provided - TagMatchStrategy *GetV1MetricsMttxQueryParamTagMatchStrategy `queryParam:"style=form,explode=true,name=tag_match_strategy"` - // Return archived incidents - Archived *bool `queryParam:"style=form,explode=true,name=archived"` - // Filters for incidents that were updated after this date - UpdatedAfter *time.Time `queryParam:"style=form,explode=true,name=updated_after"` - // Filters for incidents that were updated before this date - UpdatedBefore *time.Time `queryParam:"style=form,explode=true,name=updated_before"` - // A comma separated list of incident type IDs - IncidentTypeID *string `queryParam:"style=form,explode=true,name=incident_type_id"` - CustomFieldID *string `queryParam:"style=form,explode=true,name=custom_field_id"` - SortBy *SortBy `queryParam:"style=form,explode=true,name=sort_by"` - // Comma-separated list of measurements to include in the response - Measurements *string `queryParam:"style=form,explode=true,name=measurements"` - RequestBody *GetV1MetricsMttxRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (g GetV1MetricsMttxRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1MetricsMttxRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1MetricsMttxRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1MetricsMttxRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1MetricsMttxRequest) GetConditions() *string { - if o == nil { - return nil - } - return o.Conditions -} - -func (o *GetV1MetricsMttxRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1MetricsMttxRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1MetricsMttxRequest) GetFunctionalities() *string { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *GetV1MetricsMttxRequest) GetExcludedInfrastructureIds() *string { - if o == nil { - return nil - } - return o.ExcludedInfrastructureIds -} - -func (o *GetV1MetricsMttxRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1MetricsMttxRequest) GetAssignedTeams() *string { - if o == nil { - return nil - } - return o.AssignedTeams -} - -func (o *GetV1MetricsMttxRequest) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *GetV1MetricsMttxRequest) GetStartDate() types.Date { - if o == nil { - return types.Date{} - } - return o.StartDate -} - -func (o *GetV1MetricsMttxRequest) GetEndDate() types.Date { - if o == nil { - return types.Date{} - } - return o.EndDate -} - -func (o *GetV1MetricsMttxRequest) GetResolvedAtOrAfter() *time.Time { - if o == nil { - return nil - } - return o.ResolvedAtOrAfter -} - -func (o *GetV1MetricsMttxRequest) GetResolvedAtOrBefore() *time.Time { - if o == nil { - return nil - } - return o.ResolvedAtOrBefore -} - -func (o *GetV1MetricsMttxRequest) GetCreatedAtOrAfter() *time.Time { - if o == nil { - return nil - } - return o.CreatedAtOrAfter -} - -func (o *GetV1MetricsMttxRequest) GetCreatedAtOrBefore() *time.Time { - if o == nil { - return nil - } - return o.CreatedAtOrBefore -} - -func (o *GetV1MetricsMttxRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1MetricsMttxRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1MetricsMttxRequest) GetSavedSearchID() *string { - if o == nil { - return nil - } - return o.SavedSearchID -} - -func (o *GetV1MetricsMttxRequest) GetPriorities() *string { - if o == nil { - return nil - } - return o.Priorities -} - -func (o *GetV1MetricsMttxRequest) GetPriorityNotSet() *bool { - if o == nil { - return nil - } - return o.PriorityNotSet -} - -func (o *GetV1MetricsMttxRequest) GetSeverities() *string { - if o == nil { - return nil - } - return o.Severities -} - -func (o *GetV1MetricsMttxRequest) GetSeverityNotSet() *bool { - if o == nil { - return nil - } - return o.SeverityNotSet -} - -func (o *GetV1MetricsMttxRequest) GetCurrentMilestones() *string { - if o == nil { - return nil - } - return o.CurrentMilestones -} - -func (o *GetV1MetricsMttxRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1MetricsMttxRequest) GetTagMatchStrategy() *GetV1MetricsMttxQueryParamTagMatchStrategy { - if o == nil { - return nil - } - return o.TagMatchStrategy -} - -func (o *GetV1MetricsMttxRequest) GetArchived() *bool { - if o == nil { - return nil - } - return o.Archived -} - -func (o *GetV1MetricsMttxRequest) GetUpdatedAfter() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAfter -} - -func (o *GetV1MetricsMttxRequest) GetUpdatedBefore() *time.Time { - if o == nil { - return nil - } - return o.UpdatedBefore -} - -func (o *GetV1MetricsMttxRequest) GetIncidentTypeID() *string { - if o == nil { - return nil - } - return o.IncidentTypeID -} - -func (o *GetV1MetricsMttxRequest) GetCustomFieldID() *string { - if o == nil { - return nil - } - return o.CustomFieldID -} - -func (o *GetV1MetricsMttxRequest) GetSortBy() *SortBy { - if o == nil { - return nil - } - return o.SortBy -} - -func (o *GetV1MetricsMttxRequest) GetMeasurements() *string { - if o == nil { - return nil - } - return o.Measurements -} - -func (o *GetV1MetricsMttxRequest) GetRequestBody() *GetV1MetricsMttxRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type GetV1MetricsMttxResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Fetch infrastructure metrics based on custom query - MetricsMttxDataEntity *shared.MetricsMttxDataEntity -} - -func (o *GetV1MetricsMttxResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1MetricsMttxResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1MetricsMttxResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1MetricsMttxResponse) GetMetricsMttxDataEntity() *shared.MetricsMttxDataEntity { - if o == nil { - return nil - } - return o.MetricsMttxDataEntity -} diff --git a/internal/sdk/models/operations/getv1metricsretrospectives.go b/internal/sdk/models/operations/getv1metricsretrospectives.go deleted file mode 100644 index 2cb67d4..0000000 --- a/internal/sdk/models/operations/getv1metricsretrospectives.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" -) - -type GetV1MetricsRetrospectivesRequest struct { - // The start date to return metrics from - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return metrics from - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` -} - -func (g GetV1MetricsRetrospectivesRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1MetricsRetrospectivesRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1MetricsRetrospectivesRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1MetricsRetrospectivesRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -type GetV1MetricsRetrospectivesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns a report with retrospective analytics data - MetricsRetrospectiveEntity *shared.MetricsRetrospectiveEntity -} - -func (o *GetV1MetricsRetrospectivesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1MetricsRetrospectivesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1MetricsRetrospectivesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1MetricsRetrospectivesResponse) GetMetricsRetrospectiveEntity() *shared.MetricsRetrospectiveEntity { - if o == nil { - return nil - } - return o.MetricsRetrospectiveEntity -} diff --git a/internal/sdk/models/operations/getv1metricsticketfunnel.go b/internal/sdk/models/operations/getv1metricsticketfunnel.go deleted file mode 100644 index 842a3f9..0000000 --- a/internal/sdk/models/operations/getv1metricsticketfunnel.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" - "time" -) - -// QueryParamTagMatchStrategy - A matching strategy for the tags provided -type QueryParamTagMatchStrategy string - -const ( - QueryParamTagMatchStrategyAny QueryParamTagMatchStrategy = "any" - QueryParamTagMatchStrategyMatchAll QueryParamTagMatchStrategy = "match_all" - QueryParamTagMatchStrategyExclude QueryParamTagMatchStrategy = "exclude" -) - -func (e QueryParamTagMatchStrategy) ToPointer() *QueryParamTagMatchStrategy { - return &e -} -func (e *QueryParamTagMatchStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "any": - fallthrough - case "match_all": - fallthrough - case "exclude": - *e = QueryParamTagMatchStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for QueryParamTagMatchStrategy: %v", v) - } -} - -type GetV1MetricsTicketFunnelRequest struct { - // A JSON string that defines 'logic' and 'user_data' - Conditions *string `queryParam:"style=form,explode=true,name=conditions"` - // A comma separated list of environment IDs or 'is_empty' to filter for incidents with no impacted environments - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of service IDs or 'is_empty' to filter for incidents with no impacted services - Services *string `queryParam:"style=form,explode=true,name=services"` - // A comma separated list of functionality IDs or 'is_empty' to filter for incidents with no impacted functionalities - Functionalities *string `queryParam:"style=form,explode=true,name=functionalities"` - // A comma separated list of infrastructure IDs. Returns incidents that do not have the following infrastructure ids associated with them. - ExcludedInfrastructureIds *string `queryParam:"style=form,explode=true,name=excluded_infrastructure_ids"` - // A comma separated list of team IDs - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of IDs for assigned teams or 'is_empty' to filter for incidents with no active team assignments - AssignedTeams *string `queryParam:"style=form,explode=true,name=assigned_teams"` - // Incident status - Status *string `queryParam:"style=form,explode=true,name=status"` - // Filters for incidents that started on or after this date - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // Filters for incidents that started on or before this date - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` - // Filters for incidents that were resolved at or after this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active. - ResolvedAtOrAfter *time.Time `queryParam:"style=form,explode=true,name=resolved_at_or_after"` - // Filters for incidents that were resolved at or before this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active. - ResolvedAtOrBefore *time.Time `queryParam:"style=form,explode=true,name=resolved_at_or_before"` - // Filters for incidents that were created at or after this time - CreatedAtOrAfter *time.Time `queryParam:"style=form,explode=true,name=created_at_or_after"` - // Filters for incidents that were created at or before this time - CreatedAtOrBefore *time.Time `queryParam:"style=form,explode=true,name=created_at_or_before"` - // A text query for an incident that searches on name, summary, and desciption - Query *string `queryParam:"style=form,explode=true,name=query"` - // A query to search incidents by their name - Name *string `queryParam:"style=form,explode=true,name=name"` - // The id of a previously saved search. - SavedSearchID *string `queryParam:"style=form,explode=true,name=saved_search_id"` - // A text value of priority - Priorities *string `queryParam:"style=form,explode=true,name=priorities"` - // Flag for including incidents where priority has not been set - PriorityNotSet *bool `queryParam:"style=form,explode=true,name=priority_not_set"` - // A text value of severity - Severities *string `queryParam:"style=form,explode=true,name=severities"` - // Flag for including incidents where severity has not been set - SeverityNotSet *bool `queryParam:"style=form,explode=true,name=severity_not_set"` - // A comma separated list of current milestones - CurrentMilestones *string `queryParam:"style=form,explode=true,name=current_milestones"` - // A comma separated list of tags - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // A matching strategy for the tags provided - TagMatchStrategy *QueryParamTagMatchStrategy `queryParam:"style=form,explode=true,name=tag_match_strategy"` - // Return archived incidents - Archived *bool `queryParam:"style=form,explode=true,name=archived"` - // Filters for incidents that were updated after this date - UpdatedAfter *time.Time `queryParam:"style=form,explode=true,name=updated_after"` - // Filters for incidents that were updated before this date - UpdatedBefore *time.Time `queryParam:"style=form,explode=true,name=updated_before"` - // A comma separated list of incident type IDs - IncidentTypeID *string `queryParam:"style=form,explode=true,name=incident_type_id"` - GetV1MetricsTicketFunnel *shared.GetV1MetricsTicketFunnel `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (g GetV1MetricsTicketFunnelRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1MetricsTicketFunnelRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1MetricsTicketFunnelRequest) GetConditions() *string { - if o == nil { - return nil - } - return o.Conditions -} - -func (o *GetV1MetricsTicketFunnelRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1MetricsTicketFunnelRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1MetricsTicketFunnelRequest) GetFunctionalities() *string { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *GetV1MetricsTicketFunnelRequest) GetExcludedInfrastructureIds() *string { - if o == nil { - return nil - } - return o.ExcludedInfrastructureIds -} - -func (o *GetV1MetricsTicketFunnelRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1MetricsTicketFunnelRequest) GetAssignedTeams() *string { - if o == nil { - return nil - } - return o.AssignedTeams -} - -func (o *GetV1MetricsTicketFunnelRequest) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *GetV1MetricsTicketFunnelRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1MetricsTicketFunnelRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -func (o *GetV1MetricsTicketFunnelRequest) GetResolvedAtOrAfter() *time.Time { - if o == nil { - return nil - } - return o.ResolvedAtOrAfter -} - -func (o *GetV1MetricsTicketFunnelRequest) GetResolvedAtOrBefore() *time.Time { - if o == nil { - return nil - } - return o.ResolvedAtOrBefore -} - -func (o *GetV1MetricsTicketFunnelRequest) GetCreatedAtOrAfter() *time.Time { - if o == nil { - return nil - } - return o.CreatedAtOrAfter -} - -func (o *GetV1MetricsTicketFunnelRequest) GetCreatedAtOrBefore() *time.Time { - if o == nil { - return nil - } - return o.CreatedAtOrBefore -} - -func (o *GetV1MetricsTicketFunnelRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1MetricsTicketFunnelRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1MetricsTicketFunnelRequest) GetSavedSearchID() *string { - if o == nil { - return nil - } - return o.SavedSearchID -} - -func (o *GetV1MetricsTicketFunnelRequest) GetPriorities() *string { - if o == nil { - return nil - } - return o.Priorities -} - -func (o *GetV1MetricsTicketFunnelRequest) GetPriorityNotSet() *bool { - if o == nil { - return nil - } - return o.PriorityNotSet -} - -func (o *GetV1MetricsTicketFunnelRequest) GetSeverities() *string { - if o == nil { - return nil - } - return o.Severities -} - -func (o *GetV1MetricsTicketFunnelRequest) GetSeverityNotSet() *bool { - if o == nil { - return nil - } - return o.SeverityNotSet -} - -func (o *GetV1MetricsTicketFunnelRequest) GetCurrentMilestones() *string { - if o == nil { - return nil - } - return o.CurrentMilestones -} - -func (o *GetV1MetricsTicketFunnelRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1MetricsTicketFunnelRequest) GetTagMatchStrategy() *QueryParamTagMatchStrategy { - if o == nil { - return nil - } - return o.TagMatchStrategy -} - -func (o *GetV1MetricsTicketFunnelRequest) GetArchived() *bool { - if o == nil { - return nil - } - return o.Archived -} - -func (o *GetV1MetricsTicketFunnelRequest) GetUpdatedAfter() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAfter -} - -func (o *GetV1MetricsTicketFunnelRequest) GetUpdatedBefore() *time.Time { - if o == nil { - return nil - } - return o.UpdatedBefore -} - -func (o *GetV1MetricsTicketFunnelRequest) GetIncidentTypeID() *string { - if o == nil { - return nil - } - return o.IncidentTypeID -} - -func (o *GetV1MetricsTicketFunnelRequest) GetGetV1MetricsTicketFunnel() *shared.GetV1MetricsTicketFunnel { - if o == nil { - return nil - } - return o.GetV1MetricsTicketFunnel -} - -type GetV1MetricsTicketFunnelResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns a report with task and follow up creation and completion data - MetricsTicketFunnelMetricsEntity *shared.MetricsTicketFunnelMetricsEntity -} - -func (o *GetV1MetricsTicketFunnelResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1MetricsTicketFunnelResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1MetricsTicketFunnelResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1MetricsTicketFunnelResponse) GetMetricsTicketFunnelMetricsEntity() *shared.MetricsTicketFunnelMetricsEntity { - if o == nil { - return nil - } - return o.MetricsTicketFunnelMetricsEntity -} diff --git a/internal/sdk/models/operations/getv1metricsuserinvolvements.go b/internal/sdk/models/operations/getv1metricsuserinvolvements.go deleted file mode 100644 index b107bc1..0000000 --- a/internal/sdk/models/operations/getv1metricsuserinvolvements.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" -) - -type SortField string - -const ( - SortFieldUserCount SortField = "user_count" - SortFieldIncidentCount SortField = "incident_count" - SortFieldTimeSpent SortField = "time_spent" -) - -func (e SortField) ToPointer() *SortField { - return &e -} -func (e *SortField) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "user_count": - fallthrough - case "incident_count": - fallthrough - case "time_spent": - *e = SortField(v) - return nil - default: - return fmt.Errorf("invalid value for SortField: %v", v) - } -} - -type SortDirection string - -const ( - SortDirectionAsc SortDirection = "asc" - SortDirectionDesc SortDirection = "desc" -) - -func (e SortDirection) ToPointer() *SortDirection { - return &e -} -func (e *SortDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "asc": - fallthrough - case "desc": - *e = SortDirection(v) - return nil - default: - return fmt.Errorf("invalid value for SortDirection: %v", v) - } -} - -type GetV1MetricsUserInvolvementsRequest struct { - // The start date to return metrics from - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return metrics from - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` - BucketSize *string `queryParam:"style=form,explode=true,name=bucket_size"` - By *string `queryParam:"style=form,explode=true,name=by"` - SortField *SortField `queryParam:"style=form,explode=true,name=sort_field"` - SortDirection *SortDirection `queryParam:"style=form,explode=true,name=sort_direction"` - SortLimit *int `queryParam:"style=form,explode=true,name=sort_limit"` -} - -func (g GetV1MetricsUserInvolvementsRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1MetricsUserInvolvementsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1MetricsUserInvolvementsRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1MetricsUserInvolvementsRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -func (o *GetV1MetricsUserInvolvementsRequest) GetBucketSize() *string { - if o == nil { - return nil - } - return o.BucketSize -} - -func (o *GetV1MetricsUserInvolvementsRequest) GetBy() *string { - if o == nil { - return nil - } - return o.By -} - -func (o *GetV1MetricsUserInvolvementsRequest) GetSortField() *SortField { - if o == nil { - return nil - } - return o.SortField -} - -func (o *GetV1MetricsUserInvolvementsRequest) GetSortDirection() *SortDirection { - if o == nil { - return nil - } - return o.SortDirection -} - -func (o *GetV1MetricsUserInvolvementsRequest) GetSortLimit() *int { - if o == nil { - return nil - } - return o.SortLimit -} - -type GetV1MetricsUserInvolvementsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns a report with time bucketed analytics data - MetricsMetricsEntity *shared.MetricsMetricsEntity -} - -func (o *GetV1MetricsUserInvolvementsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1MetricsUserInvolvementsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1MetricsUserInvolvementsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1MetricsUserInvolvementsResponse) GetMetricsMetricsEntity() *shared.MetricsMetricsEntity { - if o == nil { - return nil - } - return o.MetricsMetricsEntity -} diff --git a/internal/sdk/models/operations/getv1noauthping.go b/internal/sdk/models/operations/getv1noauthping.go deleted file mode 100644 index 6f04cf7..0000000 --- a/internal/sdk/models/operations/getv1noauthping.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1NoauthPingResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Simple endpoint to verify your API connection is working - PongEntity *shared.PongEntity -} - -func (o *GetV1NoauthPingResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1NoauthPingResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1NoauthPingResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1NoauthPingResponse) GetPongEntity() *shared.PongEntity { - if o == nil { - return nil - } - return o.PongEntity -} diff --git a/internal/sdk/models/operations/getv1nuncconnections.go b/internal/sdk/models/operations/getv1nuncconnections.go deleted file mode 100644 index 7e7bdc4..0000000 --- a/internal/sdk/models/operations/getv1nuncconnections.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1NuncConnectionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists the information displayed as part of your FireHydrant hosted status pages. - NuncConnectionEntityPaginated *shared.NuncConnectionEntityPaginated -} - -func (o *GetV1NuncConnectionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1NuncConnectionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1NuncConnectionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1NuncConnectionsResponse) GetNuncConnectionEntityPaginated() *shared.NuncConnectionEntityPaginated { - if o == nil { - return nil - } - return o.NuncConnectionEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1nuncconnectionsnuncconnectionid.go b/internal/sdk/models/operations/getv1nuncconnectionsnuncconnectionid.go deleted file mode 100644 index d617e11..0000000 --- a/internal/sdk/models/operations/getv1nuncconnectionsnuncconnectionid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1NuncConnectionsNuncConnectionIDRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` -} - -func (o *GetV1NuncConnectionsNuncConnectionIDRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -type GetV1NuncConnectionsNuncConnectionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve the information displayed as part of your FireHydrant hosted status page. - NuncConnectionEntity *shared.NuncConnectionEntity -} - -func (o *GetV1NuncConnectionsNuncConnectionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1NuncConnectionsNuncConnectionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1NuncConnectionsNuncConnectionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1NuncConnectionsNuncConnectionIDResponse) GetNuncConnectionEntity() *shared.NuncConnectionEntity { - if o == nil { - return nil - } - return o.NuncConnectionEntity -} diff --git a/internal/sdk/models/operations/getv1nuncconnectionsnuncconnectionidsubscribers.go b/internal/sdk/models/operations/getv1nuncconnectionsnuncconnectionidsubscribers.go deleted file mode 100644 index 8017422..0000000 --- a/internal/sdk/models/operations/getv1nuncconnectionsnuncconnectionidsubscribers.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1NuncConnectionsNuncConnectionIDSubscribersRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` -} - -func (o *GetV1NuncConnectionsNuncConnectionIDSubscribersRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -type GetV1NuncConnectionsNuncConnectionIDSubscribersResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves the list of subscribers for a status page. - NuncEmailSubscribersEntity *shared.NuncEmailSubscribersEntity -} - -func (o *GetV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetNuncEmailSubscribersEntity() *shared.NuncEmailSubscribersEntity { - if o == nil { - return nil - } - return o.NuncEmailSubscribersEntity -} diff --git a/internal/sdk/models/operations/getv1ping.go b/internal/sdk/models/operations/getv1ping.go deleted file mode 100644 index beae967..0000000 --- a/internal/sdk/models/operations/getv1ping.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1PingResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Simple endpoint to verify your API connection is working - PongEntity *shared.PongEntity -} - -func (o *GetV1PingResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1PingResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1PingResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1PingResponse) GetPongEntity() *shared.PongEntity { - if o == nil { - return nil - } - return o.PongEntity -} diff --git a/internal/sdk/models/operations/getv1postmortemsquestions.go b/internal/sdk/models/operations/getv1postmortemsquestions.go deleted file mode 100644 index a58fea4..0000000 --- a/internal/sdk/models/operations/getv1postmortemsquestions.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1PostMortemsQuestionsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1PostMortemsQuestionsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1PostMortemsQuestionsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1PostMortemsQuestionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List the questions configured to be provided and filled out on each retrospective report. - PostMortemsQuestionTypeEntityPaginated *shared.PostMortemsQuestionTypeEntityPaginated -} - -func (o *GetV1PostMortemsQuestionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1PostMortemsQuestionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1PostMortemsQuestionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1PostMortemsQuestionsResponse) GetPostMortemsQuestionTypeEntityPaginated() *shared.PostMortemsQuestionTypeEntityPaginated { - if o == nil { - return nil - } - return o.PostMortemsQuestionTypeEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1postmortemsquestionsquestionid.go b/internal/sdk/models/operations/getv1postmortemsquestionsquestionid.go deleted file mode 100644 index b8325d0..0000000 --- a/internal/sdk/models/operations/getv1postmortemsquestionsquestionid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1PostMortemsQuestionsQuestionIDRequest struct { - QuestionID string `pathParam:"style=simple,explode=false,name=question_id"` -} - -func (o *GetV1PostMortemsQuestionsQuestionIDRequest) GetQuestionID() string { - if o == nil { - return "" - } - return o.QuestionID -} - -type GetV1PostMortemsQuestionsQuestionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1PostMortemsQuestionsQuestionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1PostMortemsQuestionsQuestionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1PostMortemsQuestionsQuestionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1postmortemsreports.go b/internal/sdk/models/operations/getv1postmortemsreports.go deleted file mode 100644 index 83bbb3c..0000000 --- a/internal/sdk/models/operations/getv1postmortemsreports.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "time" -) - -type GetV1PostMortemsReportsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // Filter the reports by an incident ID - IncidentID *string `queryParam:"style=form,explode=true,name=incident_id"` - // Filter for reports updated after the given ISO8601 timestamp - UpdatedSince *time.Time `queryParam:"style=form,explode=true,name=updated_since"` -} - -func (g GetV1PostMortemsReportsRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1PostMortemsReportsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1PostMortemsReportsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1PostMortemsReportsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1PostMortemsReportsRequest) GetIncidentID() *string { - if o == nil { - return nil - } - return o.IncidentID -} - -func (o *GetV1PostMortemsReportsRequest) GetUpdatedSince() *time.Time { - if o == nil { - return nil - } - return o.UpdatedSince -} - -type GetV1PostMortemsReportsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all reports - PostMortemsPostMortemReportEntityPaginated *shared.PostMortemsPostMortemReportEntityPaginated -} - -func (o *GetV1PostMortemsReportsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1PostMortemsReportsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1PostMortemsReportsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1PostMortemsReportsResponse) GetPostMortemsPostMortemReportEntityPaginated() *shared.PostMortemsPostMortemReportEntityPaginated { - if o == nil { - return nil - } - return o.PostMortemsPostMortemReportEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1postmortemsreportsreportid.go b/internal/sdk/models/operations/getv1postmortemsreportsreportid.go deleted file mode 100644 index e2d7375..0000000 --- a/internal/sdk/models/operations/getv1postmortemsreportsreportid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1PostMortemsReportsReportIDRequest struct { - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` -} - -func (o *GetV1PostMortemsReportsReportIDRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -type GetV1PostMortemsReportsReportIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Get a report - PostMortemsPostMortemReportEntity *shared.PostMortemsPostMortemReportEntity -} - -func (o *GetV1PostMortemsReportsReportIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1PostMortemsReportsReportIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1PostMortemsReportsReportIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1PostMortemsReportsReportIDResponse) GetPostMortemsPostMortemReportEntity() *shared.PostMortemsPostMortemReportEntity { - if o == nil { - return nil - } - return o.PostMortemsPostMortemReportEntity -} diff --git a/internal/sdk/models/operations/getv1postmortemsreportsreportidreasons.go b/internal/sdk/models/operations/getv1postmortemsreportsreportidreasons.go deleted file mode 100644 index 5360fd2..0000000 --- a/internal/sdk/models/operations/getv1postmortemsreportsreportidreasons.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1PostMortemsReportsReportIDReasonsRequest struct { - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1PostMortemsReportsReportIDReasonsRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -func (o *GetV1PostMortemsReportsReportIDReasonsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1PostMortemsReportsReportIDReasonsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1PostMortemsReportsReportIDReasonsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all contributing factors to an incident - PostMortemsReasonEntityPaginated *shared.PostMortemsReasonEntityPaginated -} - -func (o *GetV1PostMortemsReportsReportIDReasonsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1PostMortemsReportsReportIDReasonsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1PostMortemsReportsReportIDReasonsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1PostMortemsReportsReportIDReasonsResponse) GetPostMortemsReasonEntityPaginated() *shared.PostMortemsReasonEntityPaginated { - if o == nil { - return nil - } - return o.PostMortemsReasonEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1priorities.go b/internal/sdk/models/operations/getv1priorities.go deleted file mode 100644 index e21189e..0000000 --- a/internal/sdk/models/operations/getv1priorities.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1PrioritiesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1PrioritiesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1PrioritiesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1PrioritiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists priorities - PriorityEntity *shared.PriorityEntity -} - -func (o *GetV1PrioritiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1PrioritiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1PrioritiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1PrioritiesResponse) GetPriorityEntity() *shared.PriorityEntity { - if o == nil { - return nil - } - return o.PriorityEntity -} diff --git a/internal/sdk/models/operations/getv1prioritiespriorityslug.go b/internal/sdk/models/operations/getv1prioritiespriorityslug.go deleted file mode 100644 index fc1b34a..0000000 --- a/internal/sdk/models/operations/getv1prioritiespriorityslug.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1PrioritiesPrioritySlugRequest struct { - PrioritySlug string `pathParam:"style=simple,explode=false,name=priority_slug"` -} - -func (o *GetV1PrioritiesPrioritySlugRequest) GetPrioritySlug() string { - if o == nil { - return "" - } - return o.PrioritySlug -} - -type GetV1PrioritiesPrioritySlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a specific priority - PriorityEntity *shared.PriorityEntity -} - -func (o *GetV1PrioritiesPrioritySlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1PrioritiesPrioritySlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1PrioritiesPrioritySlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1PrioritiesPrioritySlugResponse) GetPriorityEntity() *shared.PriorityEntity { - if o == nil { - return nil - } - return o.PriorityEntity -} diff --git a/internal/sdk/models/operations/getv1processinglogentries.go b/internal/sdk/models/operations/getv1processinglogentries.go deleted file mode 100644 index 3cdd755..0000000 --- a/internal/sdk/models/operations/getv1processinglogentries.go +++ /dev/null @@ -1,182 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// OfLevel - Returns logs of all levels equal to or above the provided level -type OfLevel string - -const ( - OfLevelUnknown OfLevel = "unknown" - OfLevelDebug OfLevel = "debug" - OfLevelInfo OfLevel = "info" - OfLevelWarn OfLevel = "warn" - OfLevelError OfLevel = "error" - OfLevelFatal OfLevel = "fatal" -) - -func (e OfLevel) ToPointer() *OfLevel { - return &e -} -func (e *OfLevel) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "unknown": - fallthrough - case "debug": - fallthrough - case "info": - fallthrough - case "warn": - fallthrough - case "error": - fallthrough - case "fatal": - *e = OfLevel(v) - return nil - default: - return fmt.Errorf("invalid value for OfLevel: %v", v) - } -} - -// ExactLevel - Returns log entries of all levels equal to the provided level -type ExactLevel string - -const ( - ExactLevelUnknown ExactLevel = "unknown" - ExactLevelDebug ExactLevel = "debug" - ExactLevelInfo ExactLevel = "info" - ExactLevelWarn ExactLevel = "warn" - ExactLevelError ExactLevel = "error" - ExactLevelFatal ExactLevel = "fatal" -) - -func (e ExactLevel) ToPointer() *ExactLevel { - return &e -} -func (e *ExactLevel) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "unknown": - fallthrough - case "debug": - fallthrough - case "info": - fallthrough - case "warn": - fallthrough - case "error": - fallthrough - case "fatal": - *e = ExactLevel(v) - return nil - default: - return fmt.Errorf("invalid value for ExactLevel: %v", v) - } -} - -type GetV1ProcessingLogEntriesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // Scopes returned log entries to a specific integration ID - IntegrationSlug *string `queryParam:"style=form,explode=true,name=integration_slug"` - // Scopes returned log entries to a specific connection ID - ConnectionID *string `queryParam:"style=form,explode=true,name=connection_id"` - // Returns logs of all levels equal to or above the provided level - OfLevel *OfLevel `queryParam:"style=form,explode=true,name=of_level"` - // Returns log entries of all levels equal to the provided level - ExactLevel *ExactLevel `queryParam:"style=form,explode=true,name=exact_level"` -} - -func (o *GetV1ProcessingLogEntriesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1ProcessingLogEntriesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1ProcessingLogEntriesRequest) GetIntegrationSlug() *string { - if o == nil { - return nil - } - return o.IntegrationSlug -} - -func (o *GetV1ProcessingLogEntriesRequest) GetConnectionID() *string { - if o == nil { - return nil - } - return o.ConnectionID -} - -func (o *GetV1ProcessingLogEntriesRequest) GetOfLevel() *OfLevel { - if o == nil { - return nil - } - return o.OfLevel -} - -func (o *GetV1ProcessingLogEntriesRequest) GetExactLevel() *ExactLevel { - if o == nil { - return nil - } - return o.ExactLevel -} - -type GetV1ProcessingLogEntriesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Processing Log Entries for a specific alert - AlertsProcessingLogEntryEntityPaginated *shared.AlertsProcessingLogEntryEntityPaginated -} - -func (o *GetV1ProcessingLogEntriesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ProcessingLogEntriesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ProcessingLogEntriesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ProcessingLogEntriesResponse) GetAlertsProcessingLogEntryEntityPaginated() *shared.AlertsProcessingLogEntryEntityPaginated { - if o == nil { - return nil - } - return o.AlertsProcessingLogEntryEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1reportsmeantime.go b/internal/sdk/models/operations/getv1reportsmeantime.go deleted file mode 100644 index 4aa511c..0000000 --- a/internal/sdk/models/operations/getv1reportsmeantime.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "net/http" -) - -type GetV1ReportsMeanTimeRequest struct { - // A comma separated list of environment IDs - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of team IDs - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of service IDs - Services *string `queryParam:"style=form,explode=true,name=services"` - // Incident status - Status *string `queryParam:"style=form,explode=true,name=status"` - // The start date to return incidents from - StartDate *types.Date `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return incidents from - EndDate *types.Date `queryParam:"style=form,explode=true,name=end_date"` - // A text query for an incident that searches on name, summary, and desciption - Query *string `queryParam:"style=form,explode=true,name=query"` - // The id of a previously saved search. - SavedSearchID *string `queryParam:"style=form,explode=true,name=saved_search_id"` - // A comma separated list of priorities - Priorities *string `queryParam:"style=form,explode=true,name=priorities"` - // Flag for including incidents where priority has not been set - PriorityNotSet *bool `queryParam:"style=form,explode=true,name=priority_not_set"` - // A comma separated list of severities - Severities *string `queryParam:"style=form,explode=true,name=severities"` - // Flag for including incidents where severity has not been set - SeverityNotSet *bool `queryParam:"style=form,explode=true,name=severity_not_set"` - // A comma separated list of current milestones - CurrentMilestones *string `queryParam:"style=form,explode=true,name=current_milestones"` -} - -func (g GetV1ReportsMeanTimeRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1ReportsMeanTimeRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1ReportsMeanTimeRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1ReportsMeanTimeRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1ReportsMeanTimeRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1ReportsMeanTimeRequest) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *GetV1ReportsMeanTimeRequest) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1ReportsMeanTimeRequest) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -func (o *GetV1ReportsMeanTimeRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1ReportsMeanTimeRequest) GetSavedSearchID() *string { - if o == nil { - return nil - } - return o.SavedSearchID -} - -func (o *GetV1ReportsMeanTimeRequest) GetPriorities() *string { - if o == nil { - return nil - } - return o.Priorities -} - -func (o *GetV1ReportsMeanTimeRequest) GetPriorityNotSet() *bool { - if o == nil { - return nil - } - return o.PriorityNotSet -} - -func (o *GetV1ReportsMeanTimeRequest) GetSeverities() *string { - if o == nil { - return nil - } - return o.Severities -} - -func (o *GetV1ReportsMeanTimeRequest) GetSeverityNotSet() *bool { - if o == nil { - return nil - } - return o.SeverityNotSet -} - -func (o *GetV1ReportsMeanTimeRequest) GetCurrentMilestones() *string { - if o == nil { - return nil - } - return o.CurrentMilestones -} - -type GetV1ReportsMeanTimeResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns a report with time bucketed analytics data - ReportEntity *shared.ReportEntity -} - -func (o *GetV1ReportsMeanTimeResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ReportsMeanTimeResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ReportsMeanTimeResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ReportsMeanTimeResponse) GetReportEntity() *shared.ReportEntity { - if o == nil { - return nil - } - return o.ReportEntity -} diff --git a/internal/sdk/models/operations/getv1runbookaudits.go b/internal/sdk/models/operations/getv1runbookaudits.go deleted file mode 100644 index 8f5128c..0000000 --- a/internal/sdk/models/operations/getv1runbookaudits.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "net/http" -) - -// AuditableType - A query to filter audits by type -type AuditableType string - -const ( - AuditableTypeRunbooksStep AuditableType = "Runbooks::Step" - AuditableTypeRunbooksRunbook AuditableType = "Runbooks::Runbook" -) - -func (e AuditableType) ToPointer() *AuditableType { - return &e -} -func (e *AuditableType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "Runbooks::Step": - fallthrough - case "Runbooks::Runbook": - *e = AuditableType(v) - return nil - default: - return fmt.Errorf("invalid value for AuditableType: %v", v) - } -} - -type GetV1RunbookAuditsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A query to filter audits by type - AuditableType *AuditableType `default:"Runbooks::Step" queryParam:"style=form,explode=true,name=auditable_type"` - // A query to sort audits by their created_at timestamp. Options are 'asc' or 'desc' - Sort *string `queryParam:"style=form,explode=true,name=sort"` -} - -func (g GetV1RunbookAuditsRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1RunbookAuditsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1RunbookAuditsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1RunbookAuditsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1RunbookAuditsRequest) GetAuditableType() *AuditableType { - if o == nil { - return nil - } - return o.AuditableType -} - -func (o *GetV1RunbookAuditsRequest) GetSort() *string { - if o == nil { - return nil - } - return o.Sort -} - -type GetV1RunbookAuditsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1RunbookAuditsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbookAuditsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbookAuditsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1runbooks.go b/internal/sdk/models/operations/getv1runbooks.go deleted file mode 100644 index 639d81e..0000000 --- a/internal/sdk/models/operations/getv1runbooks.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// QueryParamSort - Sort runbooks by their updated date. Accepts 'asc', 'desc' -type QueryParamSort string - -const ( - QueryParamSortAsc QueryParamSort = "asc" - QueryParamSortDesc QueryParamSort = "desc" -) - -func (e QueryParamSort) ToPointer() *QueryParamSort { - return &e -} -func (e *QueryParamSort) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "asc": - fallthrough - case "desc": - *e = QueryParamSort(v) - return nil - default: - return fmt.Errorf("invalid value for QueryParamSort: %v", v) - } -} - -type GetV1RunbooksRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A query to search runbooks by their name - Name *string `queryParam:"style=form,explode=true,name=name"` - // A query to search runbooks by their owners - Owners *string `queryParam:"style=form,explode=true,name=owners"` - // Sort runbooks by their updated date. Accepts 'asc', 'desc' - Sort *QueryParamSort `queryParam:"style=form,explode=true,name=sort"` -} - -func (o *GetV1RunbooksRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1RunbooksRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1RunbooksRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1RunbooksRequest) GetOwners() *string { - if o == nil { - return nil - } - return o.Owners -} - -func (o *GetV1RunbooksRequest) GetSort() *QueryParamSort { - if o == nil { - return nil - } - return o.Sort -} - -type GetV1RunbooksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists all available runbooks. - RunbookEntity *shared.RunbookEntity -} - -func (o *GetV1RunbooksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1RunbooksResponse) GetRunbookEntity() *shared.RunbookEntity { - if o == nil { - return nil - } - return o.RunbookEntity -} diff --git a/internal/sdk/models/operations/getv1runbooksactions.go b/internal/sdk/models/operations/getv1runbooksactions.go deleted file mode 100644 index 4aeed85..0000000 --- a/internal/sdk/models/operations/getv1runbooksactions.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1RunbooksActionsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // List actions supporting this specific Runbook type - Type *string `queryParam:"style=form,explode=true,name=type"` - // Boolean to determine whether to return a slimified version of the action object's integration - Lite *bool `queryParam:"style=form,explode=true,name=lite"` -} - -func (o *GetV1RunbooksActionsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1RunbooksActionsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1RunbooksActionsRequest) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *GetV1RunbooksActionsRequest) GetLite() *bool { - if o == nil { - return nil - } - return o.Lite -} - -type GetV1RunbooksActionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all Runbook actions available through your connected integrations - RunbooksActionsEntityPaginated *shared.RunbooksActionsEntityPaginated -} - -func (o *GetV1RunbooksActionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksActionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksActionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1RunbooksActionsResponse) GetRunbooksActionsEntityPaginated() *shared.RunbooksActionsEntityPaginated { - if o == nil { - return nil - } - return o.RunbooksActionsEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1runbooksexecutions.go b/internal/sdk/models/operations/getv1runbooksexecutions.go deleted file mode 100644 index a1b8cd5..0000000 --- a/internal/sdk/models/operations/getv1runbooksexecutions.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1RunbooksExecutionsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1RunbooksExecutionsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1RunbooksExecutionsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1RunbooksExecutionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all Runbook executions across all Runbooks - RunbooksExecutionEntityPaginated *shared.RunbooksExecutionEntityPaginated -} - -func (o *GetV1RunbooksExecutionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksExecutionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksExecutionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1RunbooksExecutionsResponse) GetRunbooksExecutionEntityPaginated() *shared.RunbooksExecutionEntityPaginated { - if o == nil { - return nil - } - return o.RunbooksExecutionEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1runbooksexecutionsexecutionid.go b/internal/sdk/models/operations/getv1runbooksexecutionsexecutionid.go deleted file mode 100644 index 4ae8936..0000000 --- a/internal/sdk/models/operations/getv1runbooksexecutionsexecutionid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1RunbooksExecutionsExecutionIDRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` -} - -func (o *GetV1RunbooksExecutionsExecutionIDRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -type GetV1RunbooksExecutionsExecutionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a runbook execution by ID - RunbooksExecutionEntity *shared.RunbooksExecutionEntity -} - -func (o *GetV1RunbooksExecutionsExecutionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksExecutionsExecutionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksExecutionsExecutionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1RunbooksExecutionsExecutionIDResponse) GetRunbooksExecutionEntity() *shared.RunbooksExecutionEntity { - if o == nil { - return nil - } - return o.RunbooksExecutionEntity -} diff --git a/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidstepsstepidscript.go b/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidstepsstepidscript.go deleted file mode 100644 index 9734219..0000000 --- a/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidstepsstepidscript.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` - StepID string `pathParam:"style=simple,explode=false,name=step_id"` -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptRequest) GetStepID() string { - if o == nil { - return "" - } - return o.StepID -} - -type GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves the bash script from a "script" step. - RunbooksExecutionEntity *shared.RunbooksExecutionEntity -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptResponse) GetRunbooksExecutionEntity() *shared.RunbooksExecutionEntity { - if o == nil { - return nil - } - return o.RunbooksExecutionEntity -} diff --git a/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidstepsstepidvotesstatus.go b/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidstepsstepidvotesstatus.go deleted file mode 100644 index afb4709..0000000 --- a/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidstepsstepidvotesstatus.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` - StepID string `pathParam:"style=simple,explode=false,name=step_id"` -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusRequest) GetStepID() string { - if o == nil { - return "" - } - return o.StepID -} - -type GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns the current vote counts for an object - VotesEntity *shared.VotesEntity -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1RunbooksExecutionsExecutionIDStepsStepIDVotesStatusResponse) GetVotesEntity() *shared.VotesEntity { - if o == nil { - return nil - } - return o.VotesEntity -} diff --git a/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidvotesstatus.go b/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidvotesstatus.go deleted file mode 100644 index 031892a..0000000 --- a/internal/sdk/models/operations/getv1runbooksexecutionsexecutionidvotesstatus.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1RunbooksExecutionsExecutionIDVotesStatusRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` -} - -func (o *GetV1RunbooksExecutionsExecutionIDVotesStatusRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -type GetV1RunbooksExecutionsExecutionIDVotesStatusResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns the current vote counts for an object - VotesEntity *shared.VotesEntity -} - -func (o *GetV1RunbooksExecutionsExecutionIDVotesStatusResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksExecutionsExecutionIDVotesStatusResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksExecutionsExecutionIDVotesStatusResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1RunbooksExecutionsExecutionIDVotesStatusResponse) GetVotesEntity() *shared.VotesEntity { - if o == nil { - return nil - } - return o.VotesEntity -} diff --git a/internal/sdk/models/operations/getv1runbooksrunbookid.go b/internal/sdk/models/operations/getv1runbooksrunbookid.go deleted file mode 100644 index 15647b5..0000000 --- a/internal/sdk/models/operations/getv1runbooksrunbookid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1RunbooksRunbookIDRequest struct { - RunbookID string `pathParam:"style=simple,explode=false,name=runbook_id"` -} - -func (o *GetV1RunbooksRunbookIDRequest) GetRunbookID() string { - if o == nil { - return "" - } - return o.RunbookID -} - -type GetV1RunbooksRunbookIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Get a runbook and all its configuration - RunbookEntity *shared.RunbookEntity -} - -func (o *GetV1RunbooksRunbookIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksRunbookIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksRunbookIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1RunbooksRunbookIDResponse) GetRunbookEntity() *shared.RunbookEntity { - if o == nil { - return nil - } - return o.RunbookEntity -} diff --git a/internal/sdk/models/operations/getv1runbooksselectoptionsintegrationslugactionslugfield.go b/internal/sdk/models/operations/getv1runbooksselectoptionsintegrationslugactionslugfield.go deleted file mode 100644 index 3ada66f..0000000 --- a/internal/sdk/models/operations/getv1runbooksselectoptionsintegrationslugactionslugfield.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldRequest struct { - IntegrationSlug string `pathParam:"style=simple,explode=false,name=integration_slug"` - ActionSlug string `pathParam:"style=simple,explode=false,name=action_slug"` - Field string `pathParam:"style=simple,explode=false,name=field"` - // Text string of a query for filtering values. - Query *string `queryParam:"style=form,explode=true,name=query"` - // Generic params used to add specificity (eg an id of some kind) to the select options request - Scope *string `queryParam:"style=form,explode=true,name=scope"` - // Maximum number of items to return. - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldRequest) GetIntegrationSlug() string { - if o == nil { - return "" - } - return o.IntegrationSlug -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldRequest) GetActionSlug() string { - if o == nil { - return "" - } - return o.ActionSlug -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldRequest) GetField() string { - if o == nil { - return "" - } - return o.Field -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldRequest) GetScope() *string { - if o == nil { - return nil - } - return o.Scope -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1savedsearchesresourcetype.go b/internal/sdk/models/operations/getv1savedsearchesresourcetype.go deleted file mode 100644 index aadbaa6..0000000 --- a/internal/sdk/models/operations/getv1savedsearchesresourcetype.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SavedSearchesResourceTypePathParamResourceType string - -const ( - GetV1SavedSearchesResourceTypePathParamResourceTypeChangeEvents GetV1SavedSearchesResourceTypePathParamResourceType = "change_events" - GetV1SavedSearchesResourceTypePathParamResourceTypeIncidents GetV1SavedSearchesResourceTypePathParamResourceType = "incidents" - GetV1SavedSearchesResourceTypePathParamResourceTypeServices GetV1SavedSearchesResourceTypePathParamResourceType = "services" - GetV1SavedSearchesResourceTypePathParamResourceTypeScheduledMaintenances GetV1SavedSearchesResourceTypePathParamResourceType = "scheduled_maintenances" - GetV1SavedSearchesResourceTypePathParamResourceTypeTicketTasks GetV1SavedSearchesResourceTypePathParamResourceType = "ticket_tasks" - GetV1SavedSearchesResourceTypePathParamResourceTypeTicketFollowUps GetV1SavedSearchesResourceTypePathParamResourceType = "ticket_follow_ups" - GetV1SavedSearchesResourceTypePathParamResourceTypeAnalytics GetV1SavedSearchesResourceTypePathParamResourceType = "analytics" - GetV1SavedSearchesResourceTypePathParamResourceTypeImpactAnalytics GetV1SavedSearchesResourceTypePathParamResourceType = "impact_analytics" - GetV1SavedSearchesResourceTypePathParamResourceTypeAlerts GetV1SavedSearchesResourceTypePathParamResourceType = "alerts" - GetV1SavedSearchesResourceTypePathParamResourceTypeIncidentEvents GetV1SavedSearchesResourceTypePathParamResourceType = "incident_events" -) - -func (e GetV1SavedSearchesResourceTypePathParamResourceType) ToPointer() *GetV1SavedSearchesResourceTypePathParamResourceType { - return &e -} -func (e *GetV1SavedSearchesResourceTypePathParamResourceType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "change_events": - fallthrough - case "incidents": - fallthrough - case "services": - fallthrough - case "scheduled_maintenances": - fallthrough - case "ticket_tasks": - fallthrough - case "ticket_follow_ups": - fallthrough - case "analytics": - fallthrough - case "impact_analytics": - fallthrough - case "alerts": - fallthrough - case "incident_events": - *e = GetV1SavedSearchesResourceTypePathParamResourceType(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SavedSearchesResourceTypePathParamResourceType: %v", v) - } -} - -type GetV1SavedSearchesResourceTypeRequest struct { - ResourceType GetV1SavedSearchesResourceTypePathParamResourceType `pathParam:"style=simple,explode=false,name=resource_type"` - // The user ID used to filter saved searches. - UserID *string `queryParam:"style=form,explode=true,name=user_id"` - // Filter saved searches with a query on their name - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1SavedSearchesResourceTypeRequest) GetResourceType() GetV1SavedSearchesResourceTypePathParamResourceType { - if o == nil { - return GetV1SavedSearchesResourceTypePathParamResourceType("") - } - return o.ResourceType -} - -func (o *GetV1SavedSearchesResourceTypeRequest) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -func (o *GetV1SavedSearchesResourceTypeRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1SavedSearchesResourceTypeRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1SavedSearchesResourceTypeRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1SavedSearchesResourceTypeResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists save searches - SavedSearchEntity *shared.SavedSearchEntity -} - -func (o *GetV1SavedSearchesResourceTypeResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SavedSearchesResourceTypeResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SavedSearchesResourceTypeResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SavedSearchesResourceTypeResponse) GetSavedSearchEntity() *shared.SavedSearchEntity { - if o == nil { - return nil - } - return o.SavedSearchEntity -} diff --git a/internal/sdk/models/operations/getv1savedsearchesresourcetypesavedsearchid.go b/internal/sdk/models/operations/getv1savedsearchesresourcetypesavedsearchid.go deleted file mode 100644 index 74b4555..0000000 --- a/internal/sdk/models/operations/getv1savedsearchesresourcetypesavedsearchid.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType string - -const ( - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeChangeEvents GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "change_events" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeIncidents GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "incidents" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeServices GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "services" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeScheduledMaintenances GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "scheduled_maintenances" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeTicketTasks GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "ticket_tasks" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeTicketFollowUps GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "ticket_follow_ups" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeAnalytics GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "analytics" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeImpactAnalytics GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "impact_analytics" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeAlerts GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "alerts" - GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceTypeIncidentEvents GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType = "incident_events" -) - -func (e GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType) ToPointer() *GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType { - return &e -} -func (e *GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "change_events": - fallthrough - case "incidents": - fallthrough - case "services": - fallthrough - case "scheduled_maintenances": - fallthrough - case "ticket_tasks": - fallthrough - case "ticket_follow_ups": - fallthrough - case "analytics": - fallthrough - case "impact_analytics": - fallthrough - case "alerts": - fallthrough - case "incident_events": - *e = GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType: %v", v) - } -} - -type GetV1SavedSearchesResourceTypeSavedSearchIDRequest struct { - ResourceType GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType `pathParam:"style=simple,explode=false,name=resource_type"` - SavedSearchID string `pathParam:"style=simple,explode=false,name=saved_search_id"` -} - -func (o *GetV1SavedSearchesResourceTypeSavedSearchIDRequest) GetResourceType() GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType { - if o == nil { - return GetV1SavedSearchesResourceTypeSavedSearchIDPathParamResourceType("") - } - return o.ResourceType -} - -func (o *GetV1SavedSearchesResourceTypeSavedSearchIDRequest) GetSavedSearchID() string { - if o == nil { - return "" - } - return o.SavedSearchID -} - -type GetV1SavedSearchesResourceTypeSavedSearchIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a specific save search - SavedSearchEntity *shared.SavedSearchEntity -} - -func (o *GetV1SavedSearchesResourceTypeSavedSearchIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SavedSearchesResourceTypeSavedSearchIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SavedSearchesResourceTypeSavedSearchIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SavedSearchesResourceTypeSavedSearchIDResponse) GetSavedSearchEntity() *shared.SavedSearchEntity { - if o == nil { - return nil - } - return o.SavedSearchEntity -} diff --git a/internal/sdk/models/operations/getv1scheduledmaintenances.go b/internal/sdk/models/operations/getv1scheduledmaintenances.go deleted file mode 100644 index bf0cb3b..0000000 --- a/internal/sdk/models/operations/getv1scheduledmaintenances.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ScheduledMaintenancesRequest struct { - // Filter scheduled_maintenances with a query on their name - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1ScheduledMaintenancesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1ScheduledMaintenancesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1ScheduledMaintenancesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1ScheduledMaintenancesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists all scheduled maintenance events - ScheduledMaintenanceEntity *shared.ScheduledMaintenanceEntity -} - -func (o *GetV1ScheduledMaintenancesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ScheduledMaintenancesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ScheduledMaintenancesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ScheduledMaintenancesResponse) GetScheduledMaintenanceEntity() *shared.ScheduledMaintenanceEntity { - if o == nil { - return nil - } - return o.ScheduledMaintenanceEntity -} diff --git a/internal/sdk/models/operations/getv1scheduledmaintenancesscheduledmaintenanceid.go b/internal/sdk/models/operations/getv1scheduledmaintenancesscheduledmaintenanceid.go deleted file mode 100644 index 44f3771..0000000 --- a/internal/sdk/models/operations/getv1scheduledmaintenancesscheduledmaintenanceid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ScheduledMaintenancesScheduledMaintenanceIDRequest struct { - ScheduledMaintenanceID string `pathParam:"style=simple,explode=false,name=scheduled_maintenance_id"` -} - -func (o *GetV1ScheduledMaintenancesScheduledMaintenanceIDRequest) GetScheduledMaintenanceID() string { - if o == nil { - return "" - } - return o.ScheduledMaintenanceID -} - -type GetV1ScheduledMaintenancesScheduledMaintenanceIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Fetch the details of a scheduled maintenance event. - ScheduledMaintenanceEntity *shared.ScheduledMaintenanceEntity -} - -func (o *GetV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetScheduledMaintenanceEntity() *shared.ScheduledMaintenanceEntity { - if o == nil { - return nil - } - return o.ScheduledMaintenanceEntity -} diff --git a/internal/sdk/models/operations/getv1schedules.go b/internal/sdk/models/operations/getv1schedules.go deleted file mode 100644 index bbc0b6d..0000000 --- a/internal/sdk/models/operations/getv1schedules.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SchedulesRequest struct { - // Filter schedules with a query on their name - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1SchedulesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1SchedulesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1SchedulesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1SchedulesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all known schedules in FireHydrant as pulled from external sources - ScheduleEntityPaginated *shared.ScheduleEntityPaginated -} - -func (o *GetV1SchedulesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SchedulesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SchedulesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SchedulesResponse) GetScheduleEntityPaginated() *shared.ScheduleEntityPaginated { - if o == nil { - return nil - } - return o.ScheduleEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1scimv2groups.go b/internal/sdk/models/operations/getv1scimv2groups.go deleted file mode 100644 index 196d689..0000000 --- a/internal/sdk/models/operations/getv1scimv2groups.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1ScimV2GroupsRequest struct { - StartIndex *int `queryParam:"style=form,explode=true,name=startIndex"` - Count *int `queryParam:"style=form,explode=true,name=count"` - // This is a string used to query groups by displayName. - // - // Proper example syntax for this would be `?filter=displayName eq "My Team Name"`. - // Currently we only support the `eq` operator - Filter *string `queryParam:"style=form,explode=true,name=filter"` -} - -func (o *GetV1ScimV2GroupsRequest) GetStartIndex() *int { - if o == nil { - return nil - } - return o.StartIndex -} - -func (o *GetV1ScimV2GroupsRequest) GetCount() *int { - if o == nil { - return nil - } - return o.Count -} - -func (o *GetV1ScimV2GroupsRequest) GetFilter() *string { - if o == nil { - return nil - } - return o.Filter -} - -type GetV1ScimV2GroupsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1ScimV2GroupsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ScimV2GroupsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ScimV2GroupsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1scimv2groupsid.go b/internal/sdk/models/operations/getv1scimv2groupsid.go deleted file mode 100644 index fc9529d..0000000 --- a/internal/sdk/models/operations/getv1scimv2groupsid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1ScimV2GroupsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1ScimV2GroupsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1ScimV2GroupsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1ScimV2GroupsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ScimV2GroupsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ScimV2GroupsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1scimv2users.go b/internal/sdk/models/operations/getv1scimv2users.go deleted file mode 100644 index 289eef3..0000000 --- a/internal/sdk/models/operations/getv1scimv2users.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1ScimV2UsersRequest struct { - // This is a string used to query users by either userName or email. - // - // Proper example syntax for this would be `?filter=userName eq john` or `?filter=userName eq "john@firehydrant.com"`. - // Currently we only support the `eq` operator - Filter *string `queryParam:"style=form,explode=true,name=filter"` - // This is an integer which represents a pagination offset - StartIndex *int `queryParam:"style=form,explode=true,name=startIndex"` - // This is an integer which represents the number of items per page in the response - Count *int `queryParam:"style=form,explode=true,name=count"` -} - -func (o *GetV1ScimV2UsersRequest) GetFilter() *string { - if o == nil { - return nil - } - return o.Filter -} - -func (o *GetV1ScimV2UsersRequest) GetStartIndex() *int { - if o == nil { - return nil - } - return o.StartIndex -} - -func (o *GetV1ScimV2UsersRequest) GetCount() *int { - if o == nil { - return nil - } - return o.Count -} - -type GetV1ScimV2UsersResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1ScimV2UsersResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ScimV2UsersResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ScimV2UsersResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1scimv2usersid.go b/internal/sdk/models/operations/getv1scimv2usersid.go deleted file mode 100644 index bdb1547..0000000 --- a/internal/sdk/models/operations/getv1scimv2usersid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1ScimV2UsersIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1ScimV2UsersIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1ScimV2UsersIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1ScimV2UsersIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ScimV2UsersIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ScimV2UsersIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1servicedependenciesservicedependencyid.go b/internal/sdk/models/operations/getv1servicedependenciesservicedependencyid.go deleted file mode 100644 index 0aea351..0000000 --- a/internal/sdk/models/operations/getv1servicedependenciesservicedependencyid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ServiceDependenciesServiceDependencyIDRequest struct { - ServiceDependencyID string `pathParam:"style=simple,explode=false,name=service_dependency_id"` -} - -func (o *GetV1ServiceDependenciesServiceDependencyIDRequest) GetServiceDependencyID() string { - if o == nil { - return "" - } - return o.ServiceDependencyID -} - -type GetV1ServiceDependenciesServiceDependencyIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a single service dependency by ID - ServiceDependencyEntity *shared.ServiceDependencyEntity -} - -func (o *GetV1ServiceDependenciesServiceDependencyIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ServiceDependenciesServiceDependencyIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ServiceDependenciesServiceDependencyIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ServiceDependenciesServiceDependencyIDResponse) GetServiceDependencyEntity() *shared.ServiceDependencyEntity { - if o == nil { - return nil - } - return o.ServiceDependencyEntity -} diff --git a/internal/sdk/models/operations/getv1services.go b/internal/sdk/models/operations/getv1services.go deleted file mode 100644 index 90969eb..0000000 --- a/internal/sdk/models/operations/getv1services.go +++ /dev/null @@ -1,174 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ServicesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A comma separated list of label key / values in the format of 'key=value,key2=value2'. To filter change events that have a key (with no specific value), omit the value - Labels *string `queryParam:"style=form,explode=true,name=labels"` - // A query to search services by their name or description - Query *string `queryParam:"style=form,explode=true,name=query"` - // A query to search services by their name - Name *string `queryParam:"style=form,explode=true,name=name"` - // A query to search services by their tier - Tiers *string `queryParam:"style=form,explode=true,name=tiers"` - // A query to search services by if they are impacted with active incidents - Impacted *string `queryParam:"style=form,explode=true,name=impacted"` - // A query to search services by their owner - Owner *string `queryParam:"style=form,explode=true,name=owner"` - // A comma separated list of team ids - RespondingTeams *string `queryParam:"style=form,explode=true,name=responding_teams"` - // A comma separated list of functionality ids - Functionalities *string `queryParam:"style=form,explode=true,name=functionalities"` - // A query to find services that are available to be downstream dependencies for the passed service ID - AvailableDownstreamDependenciesForID *string `queryParam:"style=form,explode=true,name=available_downstream_dependencies_for_id"` - // A query to find services that are available to be upstream dependencies for the passed service ID - AvailableUpstreamDependenciesForID *string `queryParam:"style=form,explode=true,name=available_upstream_dependencies_for_id"` - // Boolean to determine whether to return a slimified version of the services object - Lite *bool `queryParam:"style=form,explode=true,name=lite"` - // Use in conjunction with lite param to specify additional attributes to include - Include []string `queryParam:"style=form,explode=false,name=include"` -} - -func (o *GetV1ServicesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1ServicesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1ServicesRequest) GetLabels() *string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *GetV1ServicesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1ServicesRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1ServicesRequest) GetTiers() *string { - if o == nil { - return nil - } - return o.Tiers -} - -func (o *GetV1ServicesRequest) GetImpacted() *string { - if o == nil { - return nil - } - return o.Impacted -} - -func (o *GetV1ServicesRequest) GetOwner() *string { - if o == nil { - return nil - } - return o.Owner -} - -func (o *GetV1ServicesRequest) GetRespondingTeams() *string { - if o == nil { - return nil - } - return o.RespondingTeams -} - -func (o *GetV1ServicesRequest) GetFunctionalities() *string { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *GetV1ServicesRequest) GetAvailableDownstreamDependenciesForID() *string { - if o == nil { - return nil - } - return o.AvailableDownstreamDependenciesForID -} - -func (o *GetV1ServicesRequest) GetAvailableUpstreamDependenciesForID() *string { - if o == nil { - return nil - } - return o.AvailableUpstreamDependenciesForID -} - -func (o *GetV1ServicesRequest) GetLite() *bool { - if o == nil { - return nil - } - return o.Lite -} - -func (o *GetV1ServicesRequest) GetInclude() []string { - if o == nil { - return nil - } - return o.Include -} - -type GetV1ServicesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the services that have been added to the organization. - ServiceEntityPaginated *shared.ServiceEntityPaginated -} - -func (o *GetV1ServicesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ServicesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ServicesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ServicesResponse) GetServiceEntityPaginated() *shared.ServiceEntityPaginated { - if o == nil { - return nil - } - return o.ServiceEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1servicesserviceid.go b/internal/sdk/models/operations/getv1servicesserviceid.go deleted file mode 100644 index 9b816df..0000000 --- a/internal/sdk/models/operations/getv1servicesserviceid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ServicesServiceIDRequest struct { - ServiceID string `pathParam:"style=simple,explode=false,name=service_id"` -} - -func (o *GetV1ServicesServiceIDRequest) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -type GetV1ServicesServiceIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a single service by ID - ServiceEntity *shared.ServiceEntity -} - -func (o *GetV1ServicesServiceIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ServicesServiceIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ServicesServiceIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ServicesServiceIDResponse) GetServiceEntity() *shared.ServiceEntity { - if o == nil { - return nil - } - return o.ServiceEntity -} diff --git a/internal/sdk/models/operations/getv1servicesserviceidavailabledownstreamdependencies.go b/internal/sdk/models/operations/getv1servicesserviceidavailabledownstreamdependencies.go deleted file mode 100644 index 4fcb6a3..0000000 --- a/internal/sdk/models/operations/getv1servicesserviceidavailabledownstreamdependencies.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ServicesServiceIDAvailableDownstreamDependenciesRequest struct { - ServiceID string `pathParam:"style=simple,explode=false,name=service_id"` -} - -func (o *GetV1ServicesServiceIDAvailableDownstreamDependenciesRequest) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -type GetV1ServicesServiceIDAvailableDownstreamDependenciesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves all services that are available to be downstream dependencies - ServiceEntity *shared.ServiceEntity -} - -func (o *GetV1ServicesServiceIDAvailableDownstreamDependenciesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ServicesServiceIDAvailableDownstreamDependenciesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ServicesServiceIDAvailableDownstreamDependenciesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ServicesServiceIDAvailableDownstreamDependenciesResponse) GetServiceEntity() *shared.ServiceEntity { - if o == nil { - return nil - } - return o.ServiceEntity -} diff --git a/internal/sdk/models/operations/getv1servicesserviceidavailableupstreamdependencies.go b/internal/sdk/models/operations/getv1servicesserviceidavailableupstreamdependencies.go deleted file mode 100644 index a1cbea1..0000000 --- a/internal/sdk/models/operations/getv1servicesserviceidavailableupstreamdependencies.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ServicesServiceIDAvailableUpstreamDependenciesRequest struct { - ServiceID string `pathParam:"style=simple,explode=false,name=service_id"` -} - -func (o *GetV1ServicesServiceIDAvailableUpstreamDependenciesRequest) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -type GetV1ServicesServiceIDAvailableUpstreamDependenciesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves all services that are available to be upstream dependencies - ServiceEntity *shared.ServiceEntity -} - -func (o *GetV1ServicesServiceIDAvailableUpstreamDependenciesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ServicesServiceIDAvailableUpstreamDependenciesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ServicesServiceIDAvailableUpstreamDependenciesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ServicesServiceIDAvailableUpstreamDependenciesResponse) GetServiceEntity() *shared.ServiceEntity { - if o == nil { - return nil - } - return o.ServiceEntity -} diff --git a/internal/sdk/models/operations/getv1servicesserviceiddependencies.go b/internal/sdk/models/operations/getv1servicesserviceiddependencies.go deleted file mode 100644 index 1b2b460..0000000 --- a/internal/sdk/models/operations/getv1servicesserviceiddependencies.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1ServicesServiceIDDependenciesRequest struct { - ServiceID string `pathParam:"style=simple,explode=false,name=service_id"` - // If true, returns all dependencies in one array. If false, splits dependencies into different arrays for child and parent dependencies - Flatten *bool `queryParam:"style=form,explode=true,name=flatten"` -} - -func (o *GetV1ServicesServiceIDDependenciesRequest) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -func (o *GetV1ServicesServiceIDDependenciesRequest) GetFlatten() *bool { - if o == nil { - return nil - } - return o.Flatten -} - -type GetV1ServicesServiceIDDependenciesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a service's dependencies - ServiceWithAllDependenciesEntity *shared.ServiceWithAllDependenciesEntity -} - -func (o *GetV1ServicesServiceIDDependenciesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1ServicesServiceIDDependenciesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1ServicesServiceIDDependenciesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1ServicesServiceIDDependenciesResponse) GetServiceWithAllDependenciesEntity() *shared.ServiceWithAllDependenciesEntity { - if o == nil { - return nil - } - return o.ServiceWithAllDependenciesEntity -} diff --git a/internal/sdk/models/operations/getv1severities.go b/internal/sdk/models/operations/getv1severities.go deleted file mode 100644 index e602ae3..0000000 --- a/internal/sdk/models/operations/getv1severities.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SeveritiesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1SeveritiesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1SeveritiesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1SeveritiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists severities - SeverityEntityPaginated *shared.SeverityEntityPaginated -} - -func (o *GetV1SeveritiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SeveritiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SeveritiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SeveritiesResponse) GetSeverityEntityPaginated() *shared.SeverityEntityPaginated { - if o == nil { - return nil - } - return o.SeverityEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1severitiesseverityslug.go b/internal/sdk/models/operations/getv1severitiesseverityslug.go deleted file mode 100644 index 620760e..0000000 --- a/internal/sdk/models/operations/getv1severitiesseverityslug.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SeveritiesSeveritySlugRequest struct { - SeveritySlug string `pathParam:"style=simple,explode=false,name=severity_slug"` -} - -func (o *GetV1SeveritiesSeveritySlugRequest) GetSeveritySlug() string { - if o == nil { - return "" - } - return o.SeveritySlug -} - -type GetV1SeveritiesSeveritySlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a specific severity - SeverityEntity *shared.SeverityEntity -} - -func (o *GetV1SeveritiesSeveritySlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SeveritiesSeveritySlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SeveritiesSeveritySlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SeveritiesSeveritySlugResponse) GetSeverityEntity() *shared.SeverityEntity { - if o == nil { - return nil - } - return o.SeverityEntity -} diff --git a/internal/sdk/models/operations/getv1severitymatrix.go b/internal/sdk/models/operations/getv1severitymatrix.go deleted file mode 100644 index 282fd76..0000000 --- a/internal/sdk/models/operations/getv1severitymatrix.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SeverityMatrixResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve the Severity matrix for your organization and its components and configured severities. - SeverityMatrixSeverityMatrixEntity *shared.SeverityMatrixSeverityMatrixEntity -} - -func (o *GetV1SeverityMatrixResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SeverityMatrixResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SeverityMatrixResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SeverityMatrixResponse) GetSeverityMatrixSeverityMatrixEntity() *shared.SeverityMatrixSeverityMatrixEntity { - if o == nil { - return nil - } - return o.SeverityMatrixSeverityMatrixEntity -} diff --git a/internal/sdk/models/operations/getv1severitymatrixconditions.go b/internal/sdk/models/operations/getv1severitymatrixconditions.go deleted file mode 100644 index bf376d4..0000000 --- a/internal/sdk/models/operations/getv1severitymatrixconditions.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SeverityMatrixConditionsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1SeverityMatrixConditionsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1SeverityMatrixConditionsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1SeverityMatrixConditionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists conditions - SeverityMatrixConditionEntity *shared.SeverityMatrixConditionEntity -} - -func (o *GetV1SeverityMatrixConditionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SeverityMatrixConditionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SeverityMatrixConditionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SeverityMatrixConditionsResponse) GetSeverityMatrixConditionEntity() *shared.SeverityMatrixConditionEntity { - if o == nil { - return nil - } - return o.SeverityMatrixConditionEntity -} diff --git a/internal/sdk/models/operations/getv1severitymatrixconditionsconditionid.go b/internal/sdk/models/operations/getv1severitymatrixconditionsconditionid.go deleted file mode 100644 index 8d9e0db..0000000 --- a/internal/sdk/models/operations/getv1severitymatrixconditionsconditionid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1SeverityMatrixConditionsConditionIDRequest struct { - ConditionID string `pathParam:"style=simple,explode=false,name=condition_id"` -} - -func (o *GetV1SeverityMatrixConditionsConditionIDRequest) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -type GetV1SeverityMatrixConditionsConditionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SeverityMatrixConditionsConditionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SeverityMatrixConditionsConditionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SeverityMatrixConditionsConditionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1severitymatriximpacts.go b/internal/sdk/models/operations/getv1severitymatriximpacts.go deleted file mode 100644 index adb364c..0000000 --- a/internal/sdk/models/operations/getv1severitymatriximpacts.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SeverityMatrixImpactsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1SeverityMatrixImpactsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1SeverityMatrixImpactsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1SeverityMatrixImpactsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists impacts - SeverityMatrixImpactEntity *shared.SeverityMatrixImpactEntity -} - -func (o *GetV1SeverityMatrixImpactsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SeverityMatrixImpactsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SeverityMatrixImpactsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SeverityMatrixImpactsResponse) GetSeverityMatrixImpactEntity() *shared.SeverityMatrixImpactEntity { - if o == nil { - return nil - } - return o.SeverityMatrixImpactEntity -} diff --git a/internal/sdk/models/operations/getv1signalsanalyticsgroupedmetrics.go b/internal/sdk/models/operations/getv1signalsanalyticsgroupedmetrics.go deleted file mode 100644 index ad01504..0000000 --- a/internal/sdk/models/operations/getv1signalsanalyticsgroupedmetrics.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "net/http" - "time" -) - -// GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy - String that determines how records are grouped -type GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy string - -const ( - GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBySignalRules GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy = "signal_rules" - GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupByTeams GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy = "teams" - GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupByServices GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy = "services" - GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupByEnvironments GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy = "environments" - GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupByTags GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy = "tags" -) - -func (e GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy) ToPointer() *GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy { - return &e -} -func (e *GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "signal_rules": - fallthrough - case "teams": - fallthrough - case "services": - fallthrough - case "environments": - fallthrough - case "tags": - *e = GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy: %v", v) - } -} - -// GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy - String that determines how records are sorted -type GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy string - -const ( - GetV1SignalsAnalyticsGroupedMetricsQueryParamSortByTotalOpenedAlerts GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy = "total_opened_alerts" - GetV1SignalsAnalyticsGroupedMetricsQueryParamSortByTotalAckedAlerts GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy = "total_acked_alerts" - GetV1SignalsAnalyticsGroupedMetricsQueryParamSortByTotalIncidents GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy = "total_incidents" - GetV1SignalsAnalyticsGroupedMetricsQueryParamSortByAckedPercentage GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy = "acked_percentage" - GetV1SignalsAnalyticsGroupedMetricsQueryParamSortByIncidentsPercentage GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy = "incidents_percentage" -) - -func (e GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy) ToPointer() *GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy { - return &e -} -func (e *GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "total_opened_alerts": - fallthrough - case "total_acked_alerts": - fallthrough - case "total_incidents": - fallthrough - case "acked_percentage": - fallthrough - case "incidents_percentage": - *e = GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy: %v", v) - } -} - -// GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection - String that determines how records are sorted -type GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection string - -const ( - GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirectionAsc GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection = "asc" - GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirectionDesc GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection = "desc" -) - -func (e GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection) ToPointer() *GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection { - return &e -} -func (e *GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "asc": - fallthrough - case "desc": - *e = GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection: %v", v) - } -} - -type GetV1SignalsAnalyticsGroupedMetricsRequest struct { - // A comma separated list of signal rule IDs - SignalRules *string `queryParam:"style=form,explode=true,name=signal_rules"` - // A comma separated list of team IDs - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of environment IDs - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of service IDs - Services *string `queryParam:"style=form,explode=true,name=services"` - // A comma separated list of tags - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // A comma separated list of user IDs - Users *string `queryParam:"style=form,explode=true,name=users"` - // String that determines how records are grouped - GroupBy *GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy `queryParam:"style=form,explode=true,name=group_by"` - // String that determines how records are sorted - SortBy *GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy `queryParam:"style=form,explode=true,name=sort_by"` - // String that determines how records are sorted - SortDirection *GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection `queryParam:"style=form,explode=true,name=sort_direction"` - // The start date to return metrics from - StartDate *time.Time `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return metrics from - EndDate *time.Time `queryParam:"style=form,explode=true,name=end_date"` -} - -func (g GetV1SignalsAnalyticsGroupedMetricsRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1SignalsAnalyticsGroupedMetricsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetSignalRules() *string { - if o == nil { - return nil - } - return o.SignalRules -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetUsers() *string { - if o == nil { - return nil - } - return o.Users -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetGroupBy() *GetV1SignalsAnalyticsGroupedMetricsQueryParamGroupBy { - if o == nil { - return nil - } - return o.GroupBy -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetSortBy() *GetV1SignalsAnalyticsGroupedMetricsQueryParamSortBy { - if o == nil { - return nil - } - return o.SortBy -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetSortDirection() *GetV1SignalsAnalyticsGroupedMetricsQueryParamSortDirection { - if o == nil { - return nil - } - return o.SortDirection -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetStartDate() *time.Time { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsRequest) GetEndDate() *time.Time { - if o == nil { - return nil - } - return o.EndDate -} - -type GetV1SignalsAnalyticsGroupedMetricsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsAnalyticsGroupedMetricsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalsanalyticsmttx.go b/internal/sdk/models/operations/getv1signalsanalyticsmttx.go deleted file mode 100644 index 5514847..0000000 --- a/internal/sdk/models/operations/getv1signalsanalyticsmttx.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "net/http" - "time" -) - -// GetV1SignalsAnalyticsMttxQueryParamGroupBy - String that determines how records are grouped -type GetV1SignalsAnalyticsMttxQueryParamGroupBy string - -const ( - GetV1SignalsAnalyticsMttxQueryParamGroupBySignalRules GetV1SignalsAnalyticsMttxQueryParamGroupBy = "signal_rules" - GetV1SignalsAnalyticsMttxQueryParamGroupByTeams GetV1SignalsAnalyticsMttxQueryParamGroupBy = "teams" - GetV1SignalsAnalyticsMttxQueryParamGroupByServices GetV1SignalsAnalyticsMttxQueryParamGroupBy = "services" - GetV1SignalsAnalyticsMttxQueryParamGroupByEnvironments GetV1SignalsAnalyticsMttxQueryParamGroupBy = "environments" - GetV1SignalsAnalyticsMttxQueryParamGroupByTags GetV1SignalsAnalyticsMttxQueryParamGroupBy = "tags" -) - -func (e GetV1SignalsAnalyticsMttxQueryParamGroupBy) ToPointer() *GetV1SignalsAnalyticsMttxQueryParamGroupBy { - return &e -} -func (e *GetV1SignalsAnalyticsMttxQueryParamGroupBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "signal_rules": - fallthrough - case "teams": - fallthrough - case "services": - fallthrough - case "environments": - fallthrough - case "tags": - *e = GetV1SignalsAnalyticsMttxQueryParamGroupBy(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SignalsAnalyticsMttxQueryParamGroupBy: %v", v) - } -} - -// GetV1SignalsAnalyticsMttxQueryParamSortBy - String that determines how records are sorted -type GetV1SignalsAnalyticsMttxQueryParamSortBy string - -const ( - GetV1SignalsAnalyticsMttxQueryParamSortByTotalOpenedAlerts GetV1SignalsAnalyticsMttxQueryParamSortBy = "total_opened_alerts" - GetV1SignalsAnalyticsMttxQueryParamSortByTotalAckedAlerts GetV1SignalsAnalyticsMttxQueryParamSortBy = "total_acked_alerts" - GetV1SignalsAnalyticsMttxQueryParamSortByTotalIncidents GetV1SignalsAnalyticsMttxQueryParamSortBy = "total_incidents" - GetV1SignalsAnalyticsMttxQueryParamSortByAckedPercentage GetV1SignalsAnalyticsMttxQueryParamSortBy = "acked_percentage" - GetV1SignalsAnalyticsMttxQueryParamSortByIncidentsPercentage GetV1SignalsAnalyticsMttxQueryParamSortBy = "incidents_percentage" -) - -func (e GetV1SignalsAnalyticsMttxQueryParamSortBy) ToPointer() *GetV1SignalsAnalyticsMttxQueryParamSortBy { - return &e -} -func (e *GetV1SignalsAnalyticsMttxQueryParamSortBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "total_opened_alerts": - fallthrough - case "total_acked_alerts": - fallthrough - case "total_incidents": - fallthrough - case "acked_percentage": - fallthrough - case "incidents_percentage": - *e = GetV1SignalsAnalyticsMttxQueryParamSortBy(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SignalsAnalyticsMttxQueryParamSortBy: %v", v) - } -} - -// GetV1SignalsAnalyticsMttxQueryParamSortDirection - String that determines how records are sorted -type GetV1SignalsAnalyticsMttxQueryParamSortDirection string - -const ( - GetV1SignalsAnalyticsMttxQueryParamSortDirectionAsc GetV1SignalsAnalyticsMttxQueryParamSortDirection = "asc" - GetV1SignalsAnalyticsMttxQueryParamSortDirectionDesc GetV1SignalsAnalyticsMttxQueryParamSortDirection = "desc" -) - -func (e GetV1SignalsAnalyticsMttxQueryParamSortDirection) ToPointer() *GetV1SignalsAnalyticsMttxQueryParamSortDirection { - return &e -} -func (e *GetV1SignalsAnalyticsMttxQueryParamSortDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "asc": - fallthrough - case "desc": - *e = GetV1SignalsAnalyticsMttxQueryParamSortDirection(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SignalsAnalyticsMttxQueryParamSortDirection: %v", v) - } -} - -type GetV1SignalsAnalyticsMttxRequest struct { - // A comma separated list of signal rule IDs - SignalRules *string `queryParam:"style=form,explode=true,name=signal_rules"` - // A comma separated list of team IDs - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of environment IDs - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of service IDs - Services *string `queryParam:"style=form,explode=true,name=services"` - // A comma separated list of tags - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // A comma separated list of user IDs - Users *string `queryParam:"style=form,explode=true,name=users"` - // String that determines how records are grouped - GroupBy *GetV1SignalsAnalyticsMttxQueryParamGroupBy `queryParam:"style=form,explode=true,name=group_by"` - // String that determines how records are sorted - SortBy *GetV1SignalsAnalyticsMttxQueryParamSortBy `queryParam:"style=form,explode=true,name=sort_by"` - // String that determines how records are sorted - SortDirection *GetV1SignalsAnalyticsMttxQueryParamSortDirection `queryParam:"style=form,explode=true,name=sort_direction"` - // The start date to return metrics from - StartDate *time.Time `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return metrics from - EndDate *time.Time `queryParam:"style=form,explode=true,name=end_date"` -} - -func (g GetV1SignalsAnalyticsMttxRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1SignalsAnalyticsMttxRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetSignalRules() *string { - if o == nil { - return nil - } - return o.SignalRules -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetUsers() *string { - if o == nil { - return nil - } - return o.Users -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetGroupBy() *GetV1SignalsAnalyticsMttxQueryParamGroupBy { - if o == nil { - return nil - } - return o.GroupBy -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetSortBy() *GetV1SignalsAnalyticsMttxQueryParamSortBy { - if o == nil { - return nil - } - return o.SortBy -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetSortDirection() *GetV1SignalsAnalyticsMttxQueryParamSortDirection { - if o == nil { - return nil - } - return o.SortDirection -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetStartDate() *time.Time { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1SignalsAnalyticsMttxRequest) GetEndDate() *time.Time { - if o == nil { - return nil - } - return o.EndDate -} - -type GetV1SignalsAnalyticsMttxResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsAnalyticsMttxResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsAnalyticsMttxResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsAnalyticsMttxResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalsanalyticstimeseries.go b/internal/sdk/models/operations/getv1signalsanalyticstimeseries.go deleted file mode 100644 index ca811f4..0000000 --- a/internal/sdk/models/operations/getv1signalsanalyticstimeseries.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "net/http" - "time" -) - -// Bucket - String that determines how records are grouped -type Bucket string - -const ( - BucketMonth Bucket = "month" - BucketWeek Bucket = "week" - BucketDay Bucket = "day" -) - -func (e Bucket) ToPointer() *Bucket { - return &e -} -func (e *Bucket) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "month": - fallthrough - case "week": - fallthrough - case "day": - *e = Bucket(v) - return nil - default: - return fmt.Errorf("invalid value for Bucket: %v", v) - } -} - -// QueryParamGroupBy - String that determines how records are grouped -type QueryParamGroupBy string - -const ( - QueryParamGroupBySignalRules QueryParamGroupBy = "signal_rules" - QueryParamGroupByTeams QueryParamGroupBy = "teams" - QueryParamGroupByServices QueryParamGroupBy = "services" - QueryParamGroupByEnvironments QueryParamGroupBy = "environments" - QueryParamGroupByTags QueryParamGroupBy = "tags" -) - -func (e QueryParamGroupBy) ToPointer() *QueryParamGroupBy { - return &e -} -func (e *QueryParamGroupBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "signal_rules": - fallthrough - case "teams": - fallthrough - case "services": - fallthrough - case "environments": - fallthrough - case "tags": - *e = QueryParamGroupBy(v) - return nil - default: - return fmt.Errorf("invalid value for QueryParamGroupBy: %v", v) - } -} - -// QueryParamSortBy - String that determines how records are sorted -type QueryParamSortBy string - -const ( - QueryParamSortByTotalOpenedAlerts QueryParamSortBy = "total_opened_alerts" - QueryParamSortByTotalAckedAlerts QueryParamSortBy = "total_acked_alerts" - QueryParamSortByTotalIncidents QueryParamSortBy = "total_incidents" - QueryParamSortByAckedPercentage QueryParamSortBy = "acked_percentage" - QueryParamSortByIncidentsPercentage QueryParamSortBy = "incidents_percentage" -) - -func (e QueryParamSortBy) ToPointer() *QueryParamSortBy { - return &e -} -func (e *QueryParamSortBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "total_opened_alerts": - fallthrough - case "total_acked_alerts": - fallthrough - case "total_incidents": - fallthrough - case "acked_percentage": - fallthrough - case "incidents_percentage": - *e = QueryParamSortBy(v) - return nil - default: - return fmt.Errorf("invalid value for QueryParamSortBy: %v", v) - } -} - -// GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection - String that determines how records are sorted -type GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection string - -const ( - GetV1SignalsAnalyticsTimeseriesQueryParamSortDirectionAsc GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection = "asc" - GetV1SignalsAnalyticsTimeseriesQueryParamSortDirectionDesc GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection = "desc" -) - -func (e GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection) ToPointer() *GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection { - return &e -} -func (e *GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "asc": - fallthrough - case "desc": - *e = GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection: %v", v) - } -} - -type GetV1SignalsAnalyticsTimeseriesRequest struct { - // String that determines how records are grouped - Bucket *Bucket `queryParam:"style=form,explode=true,name=bucket"` - // A comma separated list of signal rule IDs - SignalRules *string `queryParam:"style=form,explode=true,name=signal_rules"` - // A comma separated list of team IDs - Teams *string `queryParam:"style=form,explode=true,name=teams"` - // A comma separated list of environment IDs - Environments *string `queryParam:"style=form,explode=true,name=environments"` - // A comma separated list of service IDs - Services *string `queryParam:"style=form,explode=true,name=services"` - // A comma separated list of tags - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // A comma separated list of user IDs - Users *string `queryParam:"style=form,explode=true,name=users"` - // String that determines how records are grouped - GroupBy *QueryParamGroupBy `queryParam:"style=form,explode=true,name=group_by"` - // String that determines how records are sorted - SortBy *QueryParamSortBy `queryParam:"style=form,explode=true,name=sort_by"` - // String that determines how records are sorted - SortDirection *GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection `queryParam:"style=form,explode=true,name=sort_direction"` - // The start date to return metrics from - StartDate *time.Time `queryParam:"style=form,explode=true,name=start_date"` - // The end date to return metrics from - EndDate *time.Time `queryParam:"style=form,explode=true,name=end_date"` -} - -func (g GetV1SignalsAnalyticsTimeseriesRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetV1SignalsAnalyticsTimeseriesRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetBucket() *Bucket { - if o == nil { - return nil - } - return o.Bucket -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetSignalRules() *string { - if o == nil { - return nil - } - return o.SignalRules -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetTeams() *string { - if o == nil { - return nil - } - return o.Teams -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetEnvironments() *string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetUsers() *string { - if o == nil { - return nil - } - return o.Users -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetGroupBy() *QueryParamGroupBy { - if o == nil { - return nil - } - return o.GroupBy -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetSortBy() *QueryParamSortBy { - if o == nil { - return nil - } - return o.SortBy -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetSortDirection() *GetV1SignalsAnalyticsTimeseriesQueryParamSortDirection { - if o == nil { - return nil - } - return o.SortDirection -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetStartDate() *time.Time { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *GetV1SignalsAnalyticsTimeseriesRequest) GetEndDate() *time.Time { - if o == nil { - return nil - } - return o.EndDate -} - -type GetV1SignalsAnalyticsTimeseriesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsAnalyticsTimeseriesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsAnalyticsTimeseriesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsAnalyticsTimeseriesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalsemailtargets.go b/internal/sdk/models/operations/getv1signalsemailtargets.go deleted file mode 100644 index 7082f4a..0000000 --- a/internal/sdk/models/operations/getv1signalsemailtargets.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1SignalsEmailTargetsRequest struct { - // A query string to search the list of targets by. - Query *string `queryParam:"style=form,explode=true,name=query"` -} - -func (o *GetV1SignalsEmailTargetsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -type GetV1SignalsEmailTargetsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsEmailTargetsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsEmailTargetsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsEmailTargetsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalsemailtargetsid.go b/internal/sdk/models/operations/getv1signalsemailtargetsid.go deleted file mode 100644 index 8d9f201..0000000 --- a/internal/sdk/models/operations/getv1signalsemailtargetsid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1SignalsEmailTargetsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1SignalsEmailTargetsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1SignalsEmailTargetsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsEmailTargetsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsEmailTargetsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsEmailTargetsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalseventsources.go b/internal/sdk/models/operations/getv1signalseventsources.go deleted file mode 100644 index 4617ec0..0000000 --- a/internal/sdk/models/operations/getv1signalseventsources.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1SignalsEventSourcesRequest struct { - // Team ID to send signals to directly - TeamID *string `queryParam:"style=form,explode=true,name=team_id"` - // Escalation policy ID to send signals to directly. `team_id` is required if this is provided. - EscalationPolicyID *string `queryParam:"style=form,explode=true,name=escalation_policy_id"` - // On-call schedule ID to send signals to directly. `team_id` is required if this is provided. - OnCallScheduleID *string `queryParam:"style=form,explode=true,name=on_call_schedule_id"` - // User ID to send signals to directly - UserID *string `queryParam:"style=form,explode=true,name=user_id"` -} - -func (o *GetV1SignalsEventSourcesRequest) GetTeamID() *string { - if o == nil { - return nil - } - return o.TeamID -} - -func (o *GetV1SignalsEventSourcesRequest) GetEscalationPolicyID() *string { - if o == nil { - return nil - } - return o.EscalationPolicyID -} - -func (o *GetV1SignalsEventSourcesRequest) GetOnCallScheduleID() *string { - if o == nil { - return nil - } - return o.OnCallScheduleID -} - -func (o *GetV1SignalsEventSourcesRequest) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -type GetV1SignalsEventSourcesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsEventSourcesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsEventSourcesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsEventSourcesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalsingesturl.go b/internal/sdk/models/operations/getv1signalsingesturl.go deleted file mode 100644 index acabdfa..0000000 --- a/internal/sdk/models/operations/getv1signalsingesturl.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1SignalsIngestURLRequest struct { - // Team ID to send signals to directly - TeamID *string `queryParam:"style=form,explode=true,name=team_id"` - // Escalation policy ID to send signals to directly. `team_id` is required if this is provided. - EscalationPolicyID *string `queryParam:"style=form,explode=true,name=escalation_policy_id"` - // On-call schedule ID to send signals to directly. `team_id` is required if this is provided. - OnCallScheduleID *string `queryParam:"style=form,explode=true,name=on_call_schedule_id"` - // User ID to send signals to directly - UserID *string `queryParam:"style=form,explode=true,name=user_id"` -} - -func (o *GetV1SignalsIngestURLRequest) GetTeamID() *string { - if o == nil { - return nil - } - return o.TeamID -} - -func (o *GetV1SignalsIngestURLRequest) GetEscalationPolicyID() *string { - if o == nil { - return nil - } - return o.EscalationPolicyID -} - -func (o *GetV1SignalsIngestURLRequest) GetOnCallScheduleID() *string { - if o == nil { - return nil - } - return o.OnCallScheduleID -} - -func (o *GetV1SignalsIngestURLRequest) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -type GetV1SignalsIngestURLResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve the url for ingesting signals for your organization - SignalsAPIIngestKeyEntity *shared.SignalsAPIIngestKeyEntity -} - -func (o *GetV1SignalsIngestURLResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsIngestURLResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsIngestURLResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SignalsIngestURLResponse) GetSignalsAPIIngestKeyEntity() *shared.SignalsAPIIngestKeyEntity { - if o == nil { - return nil - } - return o.SignalsAPIIngestKeyEntity -} diff --git a/internal/sdk/models/operations/getv1signalsoncall.go b/internal/sdk/models/operations/getv1signalsoncall.go deleted file mode 100644 index 5393220..0000000 --- a/internal/sdk/models/operations/getv1signalsoncall.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1SignalsOnCallRequest struct { - // An optional comma separated list of team IDs to filter currently on-call users by - TeamID *string `queryParam:"style=form,explode=true,name=team_id"` -} - -func (o *GetV1SignalsOnCallRequest) GetTeamID() *string { - if o == nil { - return nil - } - return o.TeamID -} - -type GetV1SignalsOnCallResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsOnCallResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsOnCallResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsOnCallResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalstransposers.go b/internal/sdk/models/operations/getv1signalstransposers.go deleted file mode 100644 index 2c4ab2d..0000000 --- a/internal/sdk/models/operations/getv1signalstransposers.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1SignalsTransposersResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsTransposersResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsTransposersResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsTransposersResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalswebhooktargets.go b/internal/sdk/models/operations/getv1signalswebhooktargets.go deleted file mode 100644 index fc2419e..0000000 --- a/internal/sdk/models/operations/getv1signalswebhooktargets.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1SignalsWebhookTargetsRequest struct { - // A query string for searching through the list of webhook targets. - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1SignalsWebhookTargetsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1SignalsWebhookTargetsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1SignalsWebhookTargetsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1SignalsWebhookTargetsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1SignalsWebhookTargetsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsWebhookTargetsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsWebhookTargetsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1signalswebhooktargetsid.go b/internal/sdk/models/operations/getv1signalswebhooktargetsid.go deleted file mode 100644 index b72793c..0000000 --- a/internal/sdk/models/operations/getv1signalswebhooktargetsid.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1SignalsWebhookTargetsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1SignalsWebhookTargetsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1SignalsWebhookTargetsIDCreatedBy struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Source *string `json:"source,omitempty"` - Email *string `json:"email,omitempty"` -} - -func (o *GetV1SignalsWebhookTargetsIDCreatedBy) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *GetV1SignalsWebhookTargetsIDCreatedBy) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1SignalsWebhookTargetsIDCreatedBy) GetSource() *string { - if o == nil { - return nil - } - return o.Source -} - -func (o *GetV1SignalsWebhookTargetsIDCreatedBy) GetEmail() *string { - if o == nil { - return nil - } - return o.Email -} - -// GetV1SignalsWebhookTargetsIDResponseBody - Get a Signals webhook target by ID -type GetV1SignalsWebhookTargetsIDResponseBody struct { - ID *string `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - State *string `json:"state,omitempty"` - CreatedBy *GetV1SignalsWebhookTargetsIDCreatedBy `json:"created_by,omitempty"` - CreatedAt *string `json:"created_at,omitempty"` - UpdatedAt *string `json:"updated_at,omitempty"` - Subscriptions *string `json:"subscriptions,omitempty"` -} - -func (o *GetV1SignalsWebhookTargetsIDResponseBody) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *GetV1SignalsWebhookTargetsIDResponseBody) GetURL() *string { - if o == nil { - return nil - } - return o.URL -} - -func (o *GetV1SignalsWebhookTargetsIDResponseBody) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *GetV1SignalsWebhookTargetsIDResponseBody) GetCreatedBy() *GetV1SignalsWebhookTargetsIDCreatedBy { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *GetV1SignalsWebhookTargetsIDResponseBody) GetCreatedAt() *string { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *GetV1SignalsWebhookTargetsIDResponseBody) GetUpdatedAt() *string { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *GetV1SignalsWebhookTargetsIDResponseBody) GetSubscriptions() *string { - if o == nil { - return nil - } - return o.Subscriptions -} - -type GetV1SignalsWebhookTargetsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Get a Signals webhook target by ID - Object *GetV1SignalsWebhookTargetsIDResponseBody -} - -func (o *GetV1SignalsWebhookTargetsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1SignalsWebhookTargetsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1SignalsWebhookTargetsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1SignalsWebhookTargetsIDResponse) GetObject() *GetV1SignalsWebhookTargetsIDResponseBody { - if o == nil { - return nil - } - return o.Object -} diff --git a/internal/sdk/models/operations/getv1statusupdatetemplates.go b/internal/sdk/models/operations/getv1statusupdatetemplates.go deleted file mode 100644 index ab4d028..0000000 --- a/internal/sdk/models/operations/getv1statusupdatetemplates.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1StatusUpdateTemplatesRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1StatusUpdateTemplatesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1StatusUpdateTemplatesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1StatusUpdateTemplatesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all status update templates for your organization - StatusUpdateTemplateEntity *shared.StatusUpdateTemplateEntity -} - -func (o *GetV1StatusUpdateTemplatesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1StatusUpdateTemplatesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1StatusUpdateTemplatesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1StatusUpdateTemplatesResponse) GetStatusUpdateTemplateEntity() *shared.StatusUpdateTemplateEntity { - if o == nil { - return nil - } - return o.StatusUpdateTemplateEntity -} diff --git a/internal/sdk/models/operations/getv1statusupdatetemplatesstatusupdatetemplateid.go b/internal/sdk/models/operations/getv1statusupdatetemplatesstatusupdatetemplateid.go deleted file mode 100644 index e774e87..0000000 --- a/internal/sdk/models/operations/getv1statusupdatetemplatesstatusupdatetemplateid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest struct { - StatusUpdateTemplateID string `pathParam:"style=simple,explode=false,name=status_update_template_id"` -} - -func (o *GetV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest) GetStatusUpdateTemplateID() string { - if o == nil { - return "" - } - return o.StatusUpdateTemplateID -} - -type GetV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Get a single status update template by ID - StatusUpdateTemplateEntity *shared.StatusUpdateTemplateEntity -} - -func (o *GetV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetStatusUpdateTemplateEntity() *shared.StatusUpdateTemplateEntity { - if o == nil { - return nil - } - return o.StatusUpdateTemplateEntity -} diff --git a/internal/sdk/models/operations/getv1tasklists.go b/internal/sdk/models/operations/getv1tasklists.go deleted file mode 100644 index 5b34ce4..0000000 --- a/internal/sdk/models/operations/getv1tasklists.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TaskListsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1TaskListsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1TaskListsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1TaskListsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists all task lists for your organization - TaskListEntity *shared.TaskListEntity -} - -func (o *GetV1TaskListsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TaskListsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TaskListsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TaskListsResponse) GetTaskListEntity() *shared.TaskListEntity { - if o == nil { - return nil - } - return o.TaskListEntity -} diff --git a/internal/sdk/models/operations/getv1taskliststasklistid.go b/internal/sdk/models/operations/getv1taskliststasklistid.go deleted file mode 100644 index 077bac5..0000000 --- a/internal/sdk/models/operations/getv1taskliststasklistid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TaskListsTaskListIDRequest struct { - TaskListID string `pathParam:"style=simple,explode=false,name=task_list_id"` -} - -func (o *GetV1TaskListsTaskListIDRequest) GetTaskListID() string { - if o == nil { - return "" - } - return o.TaskListID -} - -type GetV1TaskListsTaskListIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a single task list by ID - TaskListEntity *shared.TaskListEntity -} - -func (o *GetV1TaskListsTaskListIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TaskListsTaskListIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TaskListsTaskListIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TaskListsTaskListIDResponse) GetTaskListEntity() *shared.TaskListEntity { - if o == nil { - return nil - } - return o.TaskListEntity -} diff --git a/internal/sdk/models/operations/getv1teams.go b/internal/sdk/models/operations/getv1teams.go deleted file mode 100644 index 84f9bfd..0000000 --- a/internal/sdk/models/operations/getv1teams.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TeamsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A query to search teams by their name or description - Query *string `queryParam:"style=form,explode=true,name=query"` - // A query to search teams by their name - Name *string `queryParam:"style=form,explode=true,name=name"` - // A comma separated list of service IDs - Services *string `queryParam:"style=form,explode=true,name=services"` - // Filter by teams that have or do not have members with a default incident role asssigned. Value may be 'present', 'blank', or the ID of an incident role. - DefaultIncidentRole *string `queryParam:"style=form,explode=true,name=default_incident_role"` - // Boolean to determine whether to return a slimified version of the teams object - Lite *bool `queryParam:"style=form,explode=true,name=lite"` -} - -func (o *GetV1TeamsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1TeamsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1TeamsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1TeamsRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *GetV1TeamsRequest) GetServices() *string { - if o == nil { - return nil - } - return o.Services -} - -func (o *GetV1TeamsRequest) GetDefaultIncidentRole() *string { - if o == nil { - return nil - } - return o.DefaultIncidentRole -} - -func (o *GetV1TeamsRequest) GetLite() *bool { - if o == nil { - return nil - } - return o.Lite -} - -type GetV1TeamsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the teams in the organization - TeamEntityPaginated *shared.TeamEntityPaginated -} - -func (o *GetV1TeamsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TeamsResponse) GetTeamEntityPaginated() *shared.TeamEntityPaginated { - if o == nil { - return nil - } - return o.TeamEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1teamsteamid.go b/internal/sdk/models/operations/getv1teamsteamid.go deleted file mode 100644 index ae87d83..0000000 --- a/internal/sdk/models/operations/getv1teamsteamid.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TeamsTeamIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - // Boolean to determine whether to return a slimified version of the teams object - Lite *bool `queryParam:"style=form,explode=true,name=lite"` -} - -func (o *GetV1TeamsTeamIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *GetV1TeamsTeamIDRequest) GetLite() *bool { - if o == nil { - return nil - } - return o.Lite -} - -type GetV1TeamsTeamIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single team from its ID - TeamEntity *shared.TeamEntity -} - -func (o *GetV1TeamsTeamIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsTeamIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsTeamIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TeamsTeamIDResponse) GetTeamEntity() *shared.TeamEntity { - if o == nil { - return nil - } - return o.TeamEntity -} diff --git a/internal/sdk/models/operations/getv1teamsteamidescalationpolicies.go b/internal/sdk/models/operations/getv1teamsteamidescalationpolicies.go deleted file mode 100644 index f5ff52e..0000000 --- a/internal/sdk/models/operations/getv1teamsteamidescalationpolicies.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TeamsTeamIDEscalationPoliciesRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - // A query string for searching through the list of escalation policies. - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1TeamsTeamIDEscalationPoliciesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1teamsteamidescalationpoliciesid.go b/internal/sdk/models/operations/getv1teamsteamidescalationpoliciesid.go deleted file mode 100644 index 0c957d5..0000000 --- a/internal/sdk/models/operations/getv1teamsteamidescalationpoliciesid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TeamsTeamIDEscalationPoliciesIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1TeamsTeamIDEscalationPoliciesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsTeamIDEscalationPoliciesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1teamsteamidoncallschedules.go b/internal/sdk/models/operations/getv1teamsteamidoncallschedules.go deleted file mode 100644 index ba8f003..0000000 --- a/internal/sdk/models/operations/getv1teamsteamidoncallschedules.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TeamsTeamIDOnCallSchedulesRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - // A query string for searching through the list of on-call schedules. - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1TeamsTeamIDOnCallSchedulesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1teamsteamidoncallschedulesscheduleid.go b/internal/sdk/models/operations/getv1teamsteamidoncallschedulesscheduleid.go deleted file mode 100644 index 765fcf3..0000000 --- a/internal/sdk/models/operations/getv1teamsteamidoncallschedulesscheduleid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TeamsTeamIDOnCallSchedulesScheduleIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ScheduleID string `pathParam:"style=simple,explode=false,name=schedule_id"` -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDRequest) GetScheduleID() string { - if o == nil { - return "" - } - return o.ScheduleID -} - -type GetV1TeamsTeamIDOnCallSchedulesScheduleIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1teamsteamidoncallschedulesscheduleidshiftsid.go b/internal/sdk/models/operations/getv1teamsteamidoncallschedulesscheduleidshiftsid.go deleted file mode 100644 index 3634ac8..0000000 --- a/internal/sdk/models/operations/getv1teamsteamidoncallschedulesscheduleidshiftsid.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ScheduleID string `pathParam:"style=simple,explode=false,name=schedule_id"` -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetScheduleID() string { - if o == nil { - return "" - } - return o.ScheduleID -} - -type GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1teamsteamidsignalrules.go b/internal/sdk/models/operations/getv1teamsteamidsignalrules.go deleted file mode 100644 index d413909..0000000 --- a/internal/sdk/models/operations/getv1teamsteamidsignalrules.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TeamsTeamIDSignalRulesRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - // A query string for searching through the list of alerting rules. - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1TeamsTeamIDSignalRulesRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *GetV1TeamsTeamIDSignalRulesRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1TeamsTeamIDSignalRulesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1TeamsTeamIDSignalRulesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1TeamsTeamIDSignalRulesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TeamsTeamIDSignalRulesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsTeamIDSignalRulesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsTeamIDSignalRulesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1teamsteamidsignalrulesid.go b/internal/sdk/models/operations/getv1teamsteamidsignalrulesid.go deleted file mode 100644 index bf4827d..0000000 --- a/internal/sdk/models/operations/getv1teamsteamidsignalrulesid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TeamsTeamIDSignalRulesIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1TeamsTeamIDSignalRulesIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *GetV1TeamsTeamIDSignalRulesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1TeamsTeamIDSignalRulesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TeamsTeamIDSignalRulesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TeamsTeamIDSignalRulesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TeamsTeamIDSignalRulesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1ticketingpriorities.go b/internal/sdk/models/operations/getv1ticketingpriorities.go deleted file mode 100644 index 5bb9d93..0000000 --- a/internal/sdk/models/operations/getv1ticketingpriorities.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingPrioritiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all ticketing priorities available to the organization - TicketingPriorityEntity *shared.TicketingPriorityEntity -} - -func (o *GetV1TicketingPrioritiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingPrioritiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingPrioritiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingPrioritiesResponse) GetTicketingPriorityEntity() *shared.TicketingPriorityEntity { - if o == nil { - return nil - } - return o.TicketingPriorityEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingprioritiesid.go b/internal/sdk/models/operations/getv1ticketingprioritiesid.go deleted file mode 100644 index 11e932b..0000000 --- a/internal/sdk/models/operations/getv1ticketingprioritiesid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingPrioritiesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (o *GetV1TicketingPrioritiesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type GetV1TicketingPrioritiesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single ticketing priority by ID - TicketingPriorityEntity *shared.TicketingPriorityEntity -} - -func (o *GetV1TicketingPrioritiesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingPrioritiesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingPrioritiesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingPrioritiesIDResponse) GetTicketingPriorityEntity() *shared.TicketingPriorityEntity { - if o == nil { - return nil - } - return o.TicketingPriorityEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingprojects.go b/internal/sdk/models/operations/getv1ticketingprojects.go deleted file mode 100644 index e030141..0000000 --- a/internal/sdk/models/operations/getv1ticketingprojects.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingProjectsRequest struct { - SupportsTicketTypes *string `queryParam:"style=form,explode=true,name=supports_ticket_types"` - Providers *string `queryParam:"style=form,explode=true,name=providers"` - ConnectionIds *string `queryParam:"style=form,explode=true,name=connection_ids"` - ConfiguredProjects *bool `queryParam:"style=form,explode=true,name=configured_projects"` - Query *string `queryParam:"style=form,explode=true,name=query"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1TicketingProjectsRequest) GetSupportsTicketTypes() *string { - if o == nil { - return nil - } - return o.SupportsTicketTypes -} - -func (o *GetV1TicketingProjectsRequest) GetProviders() *string { - if o == nil { - return nil - } - return o.Providers -} - -func (o *GetV1TicketingProjectsRequest) GetConnectionIds() *string { - if o == nil { - return nil - } - return o.ConnectionIds -} - -func (o *GetV1TicketingProjectsRequest) GetConfiguredProjects() *bool { - if o == nil { - return nil - } - return o.ConfiguredProjects -} - -func (o *GetV1TicketingProjectsRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1TicketingProjectsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1TicketingProjectsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1TicketingProjectsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all ticketing projects available to the organization - TicketingProjectsProjectListItemEntity *shared.TicketingProjectsProjectListItemEntity -} - -func (o *GetV1TicketingProjectsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingProjectsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingProjectsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingProjectsResponse) GetTicketingProjectsProjectListItemEntity() *shared.TicketingProjectsProjectListItemEntity { - if o == nil { - return nil - } - return o.TicketingProjectsProjectListItemEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectid.go b/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectid.go deleted file mode 100644 index df7a1d5..0000000 --- a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingProjectsTicketingProjectIDRequest struct { - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *GetV1TicketingProjectsTicketingProjectIDRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type GetV1TicketingProjectsTicketingProjectIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a single ticketing project by ID - TicketingProjectsProjectListItemEntity *shared.TicketingProjectsProjectListItemEntity -} - -func (o *GetV1TicketingProjectsTicketingProjectIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingProjectsTicketingProjectIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingProjectsTicketingProjectIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingProjectsTicketingProjectIDResponse) GetTicketingProjectsProjectListItemEntity() *shared.TicketingProjectsProjectListItemEntity { - if o == nil { - return nil - } - return o.TicketingProjectsProjectListItemEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidconfigurationoptions.go b/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidconfigurationoptions.go deleted file mode 100644 index e75e854..0000000 --- a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidconfigurationoptions.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsRequest struct { - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidconfigurationoptionsoptionsforfieldid.go b/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidconfigurationoptionsoptionsforfieldid.go deleted file mode 100644 index 00533d3..0000000 --- a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidconfigurationoptionsoptionsforfieldid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDRequest struct { - FieldID string `pathParam:"style=simple,explode=false,name=field_id"` - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDRequest) GetFieldID() string { - if o == nil { - return "" - } - return o.FieldID -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidfieldmapsavailablefields.go b/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidfieldmapsavailablefields.go deleted file mode 100644 index c9a7cd0..0000000 --- a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidfieldmapsavailablefields.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsRequest struct { - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns metadata for the fields that are available for field mapping. - TicketingFieldMapsMappableFieldEntity *shared.TicketingFieldMapsMappableFieldEntity -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsResponse) GetTicketingFieldMapsMappableFieldEntity() *shared.TicketingFieldMapsMappableFieldEntity { - if o == nil { - return nil - } - return o.TicketingFieldMapsMappableFieldEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidfieldmapsmapid.go b/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidfieldmapsmapid.go deleted file mode 100644 index d9a7e4a..0000000 --- a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidfieldmapsmapid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest struct { - MapID string `pathParam:"style=simple,explode=false,name=map_id"` - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest) GetMapID() string { - if o == nil { - return "" - } - return o.MapID -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve field map for a ticketing project - TicketingProjectFieldMapEntity *shared.TicketingProjectFieldMapEntity -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetTicketingProjectFieldMapEntity() *shared.TicketingProjectFieldMapEntity { - if o == nil { - return nil - } - return o.TicketingProjectFieldMapEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go b/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go deleted file mode 100644 index 3091dfc..0000000 --- a/internal/sdk/models/operations/getv1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest struct { - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` - ConfigID string `pathParam:"style=simple,explode=false,name=config_id"` -} - -func (o *GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -func (o *GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest) GetConfigID() string { - if o == nil { - return "" - } - return o.ConfigID -} - -type GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve configuration for a ticketing project - TicketingProjectConfigEntity *shared.TicketingProjectConfigEntity -} - -func (o *GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetTicketingProjectConfigEntity() *shared.TicketingProjectConfigEntity { - if o == nil { - return nil - } - return o.TicketingProjectConfigEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingtickets.go b/internal/sdk/models/operations/getv1ticketingtickets.go deleted file mode 100644 index 512cc3e..0000000 --- a/internal/sdk/models/operations/getv1ticketingtickets.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -// GetV1TicketingTicketsQueryParamTagMatchStrategy - A matching strategy for the tags provided -type GetV1TicketingTicketsQueryParamTagMatchStrategy string - -const ( - GetV1TicketingTicketsQueryParamTagMatchStrategyAny GetV1TicketingTicketsQueryParamTagMatchStrategy = "any" - GetV1TicketingTicketsQueryParamTagMatchStrategyMatchAll GetV1TicketingTicketsQueryParamTagMatchStrategy = "match_all" - GetV1TicketingTicketsQueryParamTagMatchStrategyExclude GetV1TicketingTicketsQueryParamTagMatchStrategy = "exclude" -) - -func (e GetV1TicketingTicketsQueryParamTagMatchStrategy) ToPointer() *GetV1TicketingTicketsQueryParamTagMatchStrategy { - return &e -} -func (e *GetV1TicketingTicketsQueryParamTagMatchStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "any": - fallthrough - case "match_all": - fallthrough - case "exclude": - *e = GetV1TicketingTicketsQueryParamTagMatchStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for GetV1TicketingTicketsQueryParamTagMatchStrategy: %v", v) - } -} - -// State - Filter tickets by state -type State string - -const ( - StateOpen State = "open" - StateInProgress State = "in_progress" - StateCancelled State = "cancelled" - StateDone State = "done" -) - -func (e State) ToPointer() *State { - return &e -} -func (e *State) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "open": - fallthrough - case "in_progress": - fallthrough - case "cancelled": - fallthrough - case "done": - *e = State(v) - return nil - default: - return fmt.Errorf("invalid value for State: %v", v) - } -} - -type GetV1TicketingTicketsRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // A comma separated list of tags - Tags *string `queryParam:"style=form,explode=true,name=tags"` - // A matching strategy for the tags provided - TagMatchStrategy *GetV1TicketingTicketsQueryParamTagMatchStrategy `queryParam:"style=form,explode=true,name=tag_match_strategy"` - // Filter tickets assigned to this user id - AssignedUser *string `queryParam:"style=form,explode=true,name=assigned_user"` - // Filter tickets by state - State *State `queryParam:"style=form,explode=true,name=state"` -} - -func (o *GetV1TicketingTicketsRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1TicketingTicketsRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1TicketingTicketsRequest) GetTags() *string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *GetV1TicketingTicketsRequest) GetTagMatchStrategy() *GetV1TicketingTicketsQueryParamTagMatchStrategy { - if o == nil { - return nil - } - return o.TagMatchStrategy -} - -func (o *GetV1TicketingTicketsRequest) GetAssignedUser() *string { - if o == nil { - return nil - } - return o.AssignedUser -} - -func (o *GetV1TicketingTicketsRequest) GetState() *State { - if o == nil { - return nil - } - return o.State -} - -type GetV1TicketingTicketsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the tickets that have been added to the organiation - TicketingTicketEntity *shared.TicketingTicketEntity -} - -func (o *GetV1TicketingTicketsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingTicketsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingTicketsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingTicketsResponse) GetTicketingTicketEntity() *shared.TicketingTicketEntity { - if o == nil { - return nil - } - return o.TicketingTicketEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingticketsticketid.go b/internal/sdk/models/operations/getv1ticketingticketsticketid.go deleted file mode 100644 index 5ada4cb..0000000 --- a/internal/sdk/models/operations/getv1ticketingticketsticketid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingTicketsTicketIDRequest struct { - TicketID string `pathParam:"style=simple,explode=false,name=ticket_id"` -} - -func (o *GetV1TicketingTicketsTicketIDRequest) GetTicketID() string { - if o == nil { - return "" - } - return o.TicketID -} - -type GetV1TicketingTicketsTicketIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a single ticket by ID - TicketingTicketEntity *shared.TicketingTicketEntity -} - -func (o *GetV1TicketingTicketsTicketIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingTicketsTicketIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingTicketsTicketIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingTicketsTicketIDResponse) GetTicketingTicketEntity() *shared.TicketingTicketEntity { - if o == nil { - return nil - } - return o.TicketingTicketEntity -} diff --git a/internal/sdk/models/operations/getv1ticketingtickettags.go b/internal/sdk/models/operations/getv1ticketingtickettags.go deleted file mode 100644 index aa99b15..0000000 --- a/internal/sdk/models/operations/getv1ticketingtickettags.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1TicketingTicketTagsRequest struct { - Prefix *string `queryParam:"style=form,explode=true,name=prefix"` -} - -func (o *GetV1TicketingTicketTagsRequest) GetPrefix() *string { - if o == nil { - return nil - } - return o.Prefix -} - -type GetV1TicketingTicketTagsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // List all of the ticket tags in the organization - TagEntityPaginated *shared.TagEntityPaginated -} - -func (o *GetV1TicketingTicketTagsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1TicketingTicketTagsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1TicketingTicketTagsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1TicketingTicketTagsResponse) GetTagEntityPaginated() *shared.TagEntityPaginated { - if o == nil { - return nil - } - return o.TagEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1users.go b/internal/sdk/models/operations/getv1users.go deleted file mode 100644 index 39af95c..0000000 --- a/internal/sdk/models/operations/getv1users.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1UsersRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` - // Text string of a query to filter users by name or email - Query *string `queryParam:"style=form,explode=true,name=query"` - // Text string of a query to filter users by name - Name *string `queryParam:"style=form,explode=true,name=name"` -} - -func (o *GetV1UsersRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1UsersRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -func (o *GetV1UsersRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *GetV1UsersRequest) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -type GetV1UsersResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a list of all users in an organization - UserEntityPaginated *shared.UserEntityPaginated -} - -func (o *GetV1UsersResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1UsersResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1UsersResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1UsersResponse) GetUserEntityPaginated() *shared.UserEntityPaginated { - if o == nil { - return nil - } - return o.UserEntityPaginated -} diff --git a/internal/sdk/models/operations/getv1usersidservices.go b/internal/sdk/models/operations/getv1usersidservices.go deleted file mode 100644 index 8ab3c64..0000000 --- a/internal/sdk/models/operations/getv1usersidservices.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1UsersIDServicesRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1UsersIDServicesRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *GetV1UsersIDServicesRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1UsersIDServicesRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1UsersIDServicesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieves a list of services owned by the teams a user is on - TeamEntityPaginateds []shared.TeamEntityPaginated -} - -func (o *GetV1UsersIDServicesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1UsersIDServicesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1UsersIDServicesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1UsersIDServicesResponse) GetTeamEntityPaginateds() []shared.TeamEntityPaginated { - if o == nil { - return nil - } - return o.TeamEntityPaginateds -} diff --git a/internal/sdk/models/operations/getv1webhooks.go b/internal/sdk/models/operations/getv1webhooks.go deleted file mode 100644 index 68ef58c..0000000 --- a/internal/sdk/models/operations/getv1webhooks.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1WebhooksRequest struct { - Page *int `queryParam:"style=form,explode=true,name=page"` - PerPage *int `queryParam:"style=form,explode=true,name=per_page"` -} - -func (o *GetV1WebhooksRequest) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *GetV1WebhooksRequest) GetPerPage() *int { - if o == nil { - return nil - } - return o.PerPage -} - -type GetV1WebhooksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Lists webhooks - WebhooksEntitiesWebhookEntity *shared.WebhooksEntitiesWebhookEntity -} - -func (o *GetV1WebhooksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1WebhooksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1WebhooksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1WebhooksResponse) GetWebhooksEntitiesWebhookEntity() *shared.WebhooksEntitiesWebhookEntity { - if o == nil { - return nil - } - return o.WebhooksEntitiesWebhookEntity -} diff --git a/internal/sdk/models/operations/getv1webhookswebhookid.go b/internal/sdk/models/operations/getv1webhookswebhookid.go deleted file mode 100644 index 9552ab2..0000000 --- a/internal/sdk/models/operations/getv1webhookswebhookid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type GetV1WebhooksWebhookIDRequest struct { - WebhookID string `pathParam:"style=simple,explode=false,name=webhook_id"` -} - -func (o *GetV1WebhooksWebhookIDRequest) GetWebhookID() string { - if o == nil { - return "" - } - return o.WebhookID -} - -type GetV1WebhooksWebhookIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Retrieve a specific webhook - WebhooksEntitiesWebhookEntity *shared.WebhooksEntitiesWebhookEntity -} - -func (o *GetV1WebhooksWebhookIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1WebhooksWebhookIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1WebhooksWebhookIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetV1WebhooksWebhookIDResponse) GetWebhooksEntitiesWebhookEntity() *shared.WebhooksEntitiesWebhookEntity { - if o == nil { - return nil - } - return o.WebhooksEntitiesWebhookEntity -} diff --git a/internal/sdk/models/operations/getv1webhookswebhookiddeliveries.go b/internal/sdk/models/operations/getv1webhookswebhookiddeliveries.go deleted file mode 100644 index 01c31c6..0000000 --- a/internal/sdk/models/operations/getv1webhookswebhookiddeliveries.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetV1WebhooksWebhookIDDeliveriesRequest struct { - // ID of a webhook - WebhookID string `pathParam:"style=simple,explode=false,name=webhook_id"` -} - -func (o *GetV1WebhooksWebhookIDDeliveriesRequest) GetWebhookID() string { - if o == nil { - return "" - } - return o.WebhookID -} - -type GetV1WebhooksWebhookIDDeliveriesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *GetV1WebhooksWebhookIDDeliveriesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetV1WebhooksWebhookIDDeliveriesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetV1WebhooksWebhookIDDeliveriesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/options.go b/internal/sdk/models/operations/options.go deleted file mode 100644 index 6577e1c..0000000 --- a/internal/sdk/models/operations/options.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/retry" - "time" -) - -var ErrUnsupportedOption = errors.New("unsupported option") - -const ( - SupportedOptionServerURL = "serverURL" - SupportedOptionRetries = "retries" - SupportedOptionTimeout = "timeout" - SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" - SupportedOptionURLOverride = "urlOverride" -) - -type AcceptHeaderEnum string - -const ( - AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" - AcceptHeaderEnumWildcardWildcard AcceptHeaderEnum = "*/*" -) - -func (e AcceptHeaderEnum) ToPointer() *AcceptHeaderEnum { - return &e -} - -type Options struct { - ServerURL *string - Retries *retry.Config - Timeout *time.Duration - AcceptHeaderOverride *AcceptHeaderEnum - URLOverride *string -} - -type Option func(*Options, ...string) error - -// WithServerURL allows providing an alternative server URL. -func WithServerURL(serverURL string) Option { - return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionServerURL) { - return ErrUnsupportedOption - } - - opts.ServerURL = &serverURL - return nil - } -} - -// WithTemplatedServerURL allows providing an alternative server URL with templated parameters. -func WithTemplatedServerURL(serverURL string, params map[string]string) Option { - return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionServerURL) { - return ErrUnsupportedOption - } - - if params != nil { - serverURL = utils.ReplaceParameters(serverURL, params) - } - - opts.ServerURL = &serverURL - return nil - } -} - -// WithRetries allows customizing the default retry configuration. -func WithRetries(config retry.Config) Option { - return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionRetries) { - return ErrUnsupportedOption - } - - opts.Retries = &config - return nil - } -} - -// WithOperationTimeout allows setting the request timeout applied for an operation. -func WithOperationTimeout(timeout time.Duration) Option { - return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionRetries) { - return ErrUnsupportedOption - } - - opts.Timeout = &timeout - return nil - } -} - -func WithAcceptHeaderOverride(acceptHeaderOverride AcceptHeaderEnum) Option { - return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionAcceptHeaderOverride) { - return ErrUnsupportedOption - } - - opts.AcceptHeaderOverride = &acceptHeaderOverride - return nil - } -} - -// WithURLOverride allows overriding the URL. -func WithURLOverride(urlOverride string) Option { - return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionURLOverride) { - return ErrUnsupportedOption - } - - opts.URLOverride = &urlOverride - return nil - } -} diff --git a/internal/sdk/models/operations/patchv1aipreferences.go b/internal/sdk/models/operations/patchv1aipreferences.go deleted file mode 100644 index b3952ea..0000000 --- a/internal/sdk/models/operations/patchv1aipreferences.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1AiPreferencesRequestBody struct { - // Whether to enable AI features - Ai *bool `form:"name=ai"` - // Whether to enable incident summaries - Summaries *bool `form:"name=summaries"` - // Whether to enable incident descriptions - Description *bool `form:"name=description"` - // Whether to enable incident impact - Impact *bool `form:"name=impact"` - // Whether to enable incident updates - Updates *bool `form:"name=updates"` - // Whether to enable incident retrospectives - Retros *bool `form:"name=retros"` - // Whether to enable incident followups - Followups *bool `form:"name=followups"` - // Whether to enable similar incidents - SimilarIncidents *bool `form:"name=similar_incidents"` -} - -func (o *PatchV1AiPreferencesRequestBody) GetAi() *bool { - if o == nil { - return nil - } - return o.Ai -} - -func (o *PatchV1AiPreferencesRequestBody) GetSummaries() *bool { - if o == nil { - return nil - } - return o.Summaries -} - -func (o *PatchV1AiPreferencesRequestBody) GetDescription() *bool { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1AiPreferencesRequestBody) GetImpact() *bool { - if o == nil { - return nil - } - return o.Impact -} - -func (o *PatchV1AiPreferencesRequestBody) GetUpdates() *bool { - if o == nil { - return nil - } - return o.Updates -} - -func (o *PatchV1AiPreferencesRequestBody) GetRetros() *bool { - if o == nil { - return nil - } - return o.Retros -} - -func (o *PatchV1AiPreferencesRequestBody) GetFollowups() *bool { - if o == nil { - return nil - } - return o.Followups -} - -func (o *PatchV1AiPreferencesRequestBody) GetSimilarIncidents() *bool { - if o == nil { - return nil - } - return o.SimilarIncidents -} - -type PatchV1AiPreferencesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Updates the AI preferences - AIEntitiesPreferencesEntity *shared.AIEntitiesPreferencesEntity -} - -func (o *PatchV1AiPreferencesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1AiPreferencesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1AiPreferencesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1AiPreferencesResponse) GetAIEntitiesPreferencesEntity() *shared.AIEntitiesPreferencesEntity { - if o == nil { - return nil - } - return o.AIEntitiesPreferencesEntity -} diff --git a/internal/sdk/models/operations/patchv1changeschangeid.go b/internal/sdk/models/operations/patchv1changeschangeid.go deleted file mode 100644 index 8525eda..0000000 --- a/internal/sdk/models/operations/patchv1changeschangeid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1ChangesChangeIDRequest struct { - ChangeID string `pathParam:"style=simple,explode=false,name=change_id"` - PatchV1ChangesChangeID shared.PatchV1ChangesChangeID `request:"mediaType=application/json"` -} - -func (o *PatchV1ChangesChangeIDRequest) GetChangeID() string { - if o == nil { - return "" - } - return o.ChangeID -} - -func (o *PatchV1ChangesChangeIDRequest) GetPatchV1ChangesChangeID() shared.PatchV1ChangesChangeID { - if o == nil { - return shared.PatchV1ChangesChangeID{} - } - return o.PatchV1ChangesChangeID -} - -type PatchV1ChangesChangeIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a change entry - ChangeEntity *shared.ChangeEntity -} - -func (o *PatchV1ChangesChangeIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1ChangesChangeIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1ChangesChangeIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1ChangesChangeIDResponse) GetChangeEntity() *shared.ChangeEntity { - if o == nil { - return nil - } - return o.ChangeEntity -} diff --git a/internal/sdk/models/operations/patchv1changeschangeididentitiesidentityid.go b/internal/sdk/models/operations/patchv1changeschangeididentitiesidentityid.go deleted file mode 100644 index 606b746..0000000 --- a/internal/sdk/models/operations/patchv1changeschangeididentitiesidentityid.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1ChangesChangeIDIdentitiesIdentityIDRequest struct { - IdentityID string `pathParam:"style=simple,explode=false,name=identity_id"` - ChangeID string `pathParam:"style=simple,explode=false,name=change_id"` - PatchV1ChangesChangeIDIdentitiesIdentityID shared.PatchV1ChangesChangeIDIdentitiesIdentityID `request:"mediaType=application/json"` -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityIDRequest) GetIdentityID() string { - if o == nil { - return "" - } - return o.IdentityID -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityIDRequest) GetChangeID() string { - if o == nil { - return "" - } - return o.ChangeID -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityIDRequest) GetPatchV1ChangesChangeIDIdentitiesIdentityID() shared.PatchV1ChangesChangeIDIdentitiesIdentityID { - if o == nil { - return shared.PatchV1ChangesChangeIDIdentitiesIdentityID{} - } - return o.PatchV1ChangesChangeIDIdentitiesIdentityID -} - -type PatchV1ChangesChangeIDIdentitiesIdentityIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update an identity - ChangeIdentityEntity *shared.ChangeIdentityEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityIDResponse) GetChangeIdentityEntity() *shared.ChangeIdentityEntity { - if o == nil { - return nil - } - return o.ChangeIdentityEntity -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityIDResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/patchv1changeseventschangeeventid.go b/internal/sdk/models/operations/patchv1changeseventschangeeventid.go deleted file mode 100644 index ec510ad..0000000 --- a/internal/sdk/models/operations/patchv1changeseventschangeeventid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1ChangesEventsChangeEventIDRequest struct { - ChangeEventID string `pathParam:"style=simple,explode=false,name=change_event_id"` - PatchV1ChangesEventsChangeEventID shared.PatchV1ChangesEventsChangeEventID `request:"mediaType=application/json"` -} - -func (o *PatchV1ChangesEventsChangeEventIDRequest) GetChangeEventID() string { - if o == nil { - return "" - } - return o.ChangeEventID -} - -func (o *PatchV1ChangesEventsChangeEventIDRequest) GetPatchV1ChangesEventsChangeEventID() shared.PatchV1ChangesEventsChangeEventID { - if o == nil { - return shared.PatchV1ChangesEventsChangeEventID{} - } - return o.PatchV1ChangesEventsChangeEventID -} - -type PatchV1ChangesEventsChangeEventIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a change event - ChangeEventEntity *shared.ChangeEventEntity -} - -func (o *PatchV1ChangesEventsChangeEventIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1ChangesEventsChangeEventIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1ChangesEventsChangeEventIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1ChangesEventsChangeEventIDResponse) GetChangeEventEntity() *shared.ChangeEventEntity { - if o == nil { - return nil - } - return o.ChangeEventEntity -} diff --git a/internal/sdk/models/operations/patchv1checklisttemplatesid.go b/internal/sdk/models/operations/patchv1checklisttemplatesid.go deleted file mode 100644 index e918644..0000000 --- a/internal/sdk/models/operations/patchv1checklisttemplatesid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1ChecklistTemplatesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1ChecklistTemplatesID shared.PatchV1ChecklistTemplatesID `request:"mediaType=application/json"` -} - -func (o *PatchV1ChecklistTemplatesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1ChecklistTemplatesIDRequest) GetPatchV1ChecklistTemplatesID() shared.PatchV1ChecklistTemplatesID { - if o == nil { - return shared.PatchV1ChecklistTemplatesID{} - } - return o.PatchV1ChecklistTemplatesID -} - -type PatchV1ChecklistTemplatesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a checklist templates attributes - ChecklistTemplateEntity *shared.ChecklistTemplateEntity -} - -func (o *PatchV1ChecklistTemplatesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1ChecklistTemplatesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1ChecklistTemplatesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1ChecklistTemplatesIDResponse) GetChecklistTemplateEntity() *shared.ChecklistTemplateEntity { - if o == nil { - return nil - } - return o.ChecklistTemplateEntity -} diff --git a/internal/sdk/models/operations/patchv1conversationsconversationidcommentscommentid.go b/internal/sdk/models/operations/patchv1conversationsconversationidcommentscommentid.go deleted file mode 100644 index 0ffe00d..0000000 --- a/internal/sdk/models/operations/patchv1conversationsconversationidcommentscommentid.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1ConversationsConversationIDCommentsCommentIDRequest struct { - CommentID string `pathParam:"style=simple,explode=false,name=comment_id"` - ConversationID string `pathParam:"style=simple,explode=false,name=conversation_id"` - PatchV1ConversationsConversationIDCommentsCommentID shared.PatchV1ConversationsConversationIDCommentsCommentID `request:"mediaType=application/json"` -} - -func (o *PatchV1ConversationsConversationIDCommentsCommentIDRequest) GetCommentID() string { - if o == nil { - return "" - } - return o.CommentID -} - -func (o *PatchV1ConversationsConversationIDCommentsCommentIDRequest) GetConversationID() string { - if o == nil { - return "" - } - return o.ConversationID -} - -func (o *PatchV1ConversationsConversationIDCommentsCommentIDRequest) GetPatchV1ConversationsConversationIDCommentsCommentID() shared.PatchV1ConversationsConversationIDCommentsCommentID { - if o == nil { - return shared.PatchV1ConversationsConversationIDCommentsCommentID{} - } - return o.PatchV1ConversationsConversationIDCommentsCommentID -} - -type PatchV1ConversationsConversationIDCommentsCommentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1ConversationsConversationIDCommentsCommentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1ConversationsConversationIDCommentsCommentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1ConversationsConversationIDCommentsCommentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1customfieldsdefinitionsfieldid.go b/internal/sdk/models/operations/patchv1customfieldsdefinitionsfieldid.go deleted file mode 100644 index 677c208..0000000 --- a/internal/sdk/models/operations/patchv1customfieldsdefinitionsfieldid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1CustomFieldsDefinitionsFieldIDRequest struct { - FieldID string `pathParam:"style=simple,explode=false,name=field_id"` - PatchV1CustomFieldsDefinitionsFieldID shared.PatchV1CustomFieldsDefinitionsFieldID `request:"mediaType=application/json"` -} - -func (o *PatchV1CustomFieldsDefinitionsFieldIDRequest) GetFieldID() string { - if o == nil { - return "" - } - return o.FieldID -} - -func (o *PatchV1CustomFieldsDefinitionsFieldIDRequest) GetPatchV1CustomFieldsDefinitionsFieldID() shared.PatchV1CustomFieldsDefinitionsFieldID { - if o == nil { - return shared.PatchV1CustomFieldsDefinitionsFieldID{} - } - return o.PatchV1CustomFieldsDefinitionsFieldID -} - -type PatchV1CustomFieldsDefinitionsFieldIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a single custom field definition - OrganizationsCustomFieldDefinitionEntity *shared.OrganizationsCustomFieldDefinitionEntity -} - -func (o *PatchV1CustomFieldsDefinitionsFieldIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1CustomFieldsDefinitionsFieldIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1CustomFieldsDefinitionsFieldIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1CustomFieldsDefinitionsFieldIDResponse) GetOrganizationsCustomFieldDefinitionEntity() *shared.OrganizationsCustomFieldDefinitionEntity { - if o == nil { - return nil - } - return o.OrganizationsCustomFieldDefinitionEntity -} diff --git a/internal/sdk/models/operations/patchv1environmentsenvironmentid.go b/internal/sdk/models/operations/patchv1environmentsenvironmentid.go deleted file mode 100644 index 6addf20..0000000 --- a/internal/sdk/models/operations/patchv1environmentsenvironmentid.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1EnvironmentsEnvironmentIDRequest struct { - // Environment UUID - EnvironmentID string `pathParam:"style=simple,explode=false,name=environment_id"` - PatchV1EnvironmentsEnvironmentID shared.PatchV1EnvironmentsEnvironmentID `request:"mediaType=application/json"` -} - -func (o *PatchV1EnvironmentsEnvironmentIDRequest) GetEnvironmentID() string { - if o == nil { - return "" - } - return o.EnvironmentID -} - -func (o *PatchV1EnvironmentsEnvironmentIDRequest) GetPatchV1EnvironmentsEnvironmentID() shared.PatchV1EnvironmentsEnvironmentID { - if o == nil { - return shared.PatchV1EnvironmentsEnvironmentID{} - } - return o.PatchV1EnvironmentsEnvironmentID -} - -type PatchV1EnvironmentsEnvironmentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a environments attributes - EnvironmentEntryEntity *shared.EnvironmentEntryEntity -} - -func (o *PatchV1EnvironmentsEnvironmentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1EnvironmentsEnvironmentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1EnvironmentsEnvironmentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1EnvironmentsEnvironmentIDResponse) GetEnvironmentEntryEntity() *shared.EnvironmentEntryEntity { - if o == nil { - return nil - } - return o.EnvironmentEntryEntity -} diff --git a/internal/sdk/models/operations/patchv1functionalitiesfunctionalityid.go b/internal/sdk/models/operations/patchv1functionalitiesfunctionalityid.go deleted file mode 100644 index bc57bd0..0000000 --- a/internal/sdk/models/operations/patchv1functionalitiesfunctionalityid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1FunctionalitiesFunctionalityIDRequest struct { - FunctionalityID string `pathParam:"style=simple,explode=false,name=functionality_id"` - PatchV1FunctionalitiesFunctionalityID shared.PatchV1FunctionalitiesFunctionalityID `request:"mediaType=application/json"` -} - -func (o *PatchV1FunctionalitiesFunctionalityIDRequest) GetFunctionalityID() string { - if o == nil { - return "" - } - return o.FunctionalityID -} - -func (o *PatchV1FunctionalitiesFunctionalityIDRequest) GetPatchV1FunctionalitiesFunctionalityID() shared.PatchV1FunctionalitiesFunctionalityID { - if o == nil { - return shared.PatchV1FunctionalitiesFunctionalityID{} - } - return o.PatchV1FunctionalitiesFunctionalityID -} - -type PatchV1FunctionalitiesFunctionalityIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a functionalities attributes - FunctionalityEntity *shared.FunctionalityEntity -} - -func (o *PatchV1FunctionalitiesFunctionalityIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1FunctionalitiesFunctionalityIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1FunctionalitiesFunctionalityIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1FunctionalitiesFunctionalityIDResponse) GetFunctionalityEntity() *shared.FunctionalityEntity { - if o == nil { - return nil - } - return o.FunctionalityEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentrolesincidentroleid.go b/internal/sdk/models/operations/patchv1incidentrolesincidentroleid.go deleted file mode 100644 index 349ebec..0000000 --- a/internal/sdk/models/operations/patchv1incidentrolesincidentroleid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentRolesIncidentRoleIDRequest struct { - IncidentRoleID string `pathParam:"style=simple,explode=false,name=incident_role_id"` - PatchV1IncidentRolesIncidentRoleID shared.PatchV1IncidentRolesIncidentRoleID `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentRolesIncidentRoleIDRequest) GetIncidentRoleID() string { - if o == nil { - return "" - } - return o.IncidentRoleID -} - -func (o *PatchV1IncidentRolesIncidentRoleIDRequest) GetPatchV1IncidentRolesIncidentRoleID() shared.PatchV1IncidentRolesIncidentRoleID { - if o == nil { - return shared.PatchV1IncidentRolesIncidentRoleID{} - } - return o.PatchV1IncidentRolesIncidentRoleID -} - -type PatchV1IncidentRolesIncidentRoleIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a single incident role from its ID - IncidentRoleEntity *shared.IncidentRoleEntity -} - -func (o *PatchV1IncidentRolesIncidentRoleIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentRolesIncidentRoleIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentRolesIncidentRoleIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentRolesIncidentRoleIDResponse) GetIncidentRoleEntity() *shared.IncidentRoleEntity { - if o == nil { - return nil - } - return o.IncidentRoleEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentid.go b/internal/sdk/models/operations/patchv1incidentsincidentid.go deleted file mode 100644 index 73091cc..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PatchV1IncidentsIncidentID shared.PatchV1IncidentsIncidentID `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentsIncidentIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDRequest) GetPatchV1IncidentsIncidentID() shared.PatchV1IncidentsIncidentID { - if o == nil { - return shared.PatchV1IncidentsIncidentID{} - } - return o.PatchV1IncidentsIncidentID -} - -type PatchV1IncidentsIncidentIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Updates an incident with provided parameters - IncidentEntity *shared.IncidentEntity -} - -func (o *PatchV1IncidentsIncidentIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentidalertsincidentalertidprimary.go b/internal/sdk/models/operations/patchv1incidentsincidentidalertsincidentalertidprimary.go deleted file mode 100644 index 71bc515..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentidalertsincidentalertidprimary.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryRequest struct { - IncidentAlertID string `pathParam:"style=simple,explode=false,name=incident_alert_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary shared.PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryRequest) GetIncidentAlertID() string { - if o == nil { - return "" - } - return o.IncidentAlertID -} - -func (o *PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryRequest) GetPatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary() shared.PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary { - if o == nil { - return shared.PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary{} - } - return o.PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary -} - -type PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Setting an alert as primary will overwrite milestone times in the FireHydrant incident with times included in the primary alert. Services attached to the primary alert will also be automatically added to the incident. - IncidentsAlertEntity *shared.IncidentsAlertEntity -} - -func (o *PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimaryResponse) GetIncidentsAlertEntity() *shared.IncidentsAlertEntity { - if o == nil { - return nil - } - return o.IncidentsAlertEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentideventseventid.go b/internal/sdk/models/operations/patchv1incidentsincidentideventseventid.go deleted file mode 100644 index 614b78b..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentideventseventid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDEventsEventIDRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - EventID string `pathParam:"style=simple,explode=false,name=event_id"` -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDRequest) GetEventID() string { - if o == nil { - return "" - } - return o.EventID -} - -type PatchV1IncidentsIncidentIDEventsEventIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a single event for an incident - IncidentEventEntity *shared.IncidentEventEntity -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDResponse) GetIncidentEventEntity() *shared.IncidentEventEntity { - if o == nil { - return nil - } - return o.IncidentEventEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentideventseventidvotes.go b/internal/sdk/models/operations/patchv1incidentsincidentideventseventidvotes.go deleted file mode 100644 index 74ffd24..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentideventseventidvotes.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDEventsEventIDVotesRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - EventID string `pathParam:"style=simple,explode=false,name=event_id"` - PatchV1IncidentsIncidentIDEventsEventIDVotes shared.PatchV1IncidentsIncidentIDEventsEventIDVotes `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDVotesRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDVotesRequest) GetEventID() string { - if o == nil { - return "" - } - return o.EventID -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDVotesRequest) GetPatchV1IncidentsIncidentIDEventsEventIDVotes() shared.PatchV1IncidentsIncidentIDEventsEventIDVotes { - if o == nil { - return shared.PatchV1IncidentsIncidentIDEventsEventIDVotes{} - } - return o.PatchV1IncidentsIncidentIDEventsEventIDVotes -} - -type PatchV1IncidentsIncidentIDEventsEventIDVotesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Allows for upvoting or downvoting an event - VotesEntity *shared.VotesEntity -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDVotesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDVotesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDVotesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDVotesResponse) GetVotesEntity() *shared.VotesEntity { - if o == nil { - return nil - } - return o.VotesEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentidgenericchatmessagesmessageid.go b/internal/sdk/models/operations/patchv1incidentsincidentidgenericchatmessagesmessageid.go deleted file mode 100644 index 4480c8f..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentidgenericchatmessagesmessageid.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest struct { - MessageID string `pathParam:"style=simple,explode=false,name=message_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PatchV1IncidentsIncidentIDGenericChatMessagesMessageID shared.PatchV1IncidentsIncidentIDGenericChatMessagesMessageID `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest) GetMessageID() string { - if o == nil { - return "" - } - return o.MessageID -} - -func (o *PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDRequest) GetPatchV1IncidentsIncidentIDGenericChatMessagesMessageID() shared.PatchV1IncidentsIncidentIDGenericChatMessagesMessageID { - if o == nil { - return shared.PatchV1IncidentsIncidentIDGenericChatMessagesMessageID{} - } - return o.PatchV1IncidentsIncidentIDGenericChatMessagesMessageID -} - -type PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update an existing generic chat message on an incident. - EventGenericChatMessageEntity *shared.EventGenericChatMessageEntity -} - -func (o *PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDGenericChatMessagesMessageIDResponse) GetEventGenericChatMessageEntity() *shared.EventGenericChatMessageEntity { - if o == nil { - return nil - } - return o.EventGenericChatMessageEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentidimpact.go b/internal/sdk/models/operations/patchv1incidentsincidentidimpact.go deleted file mode 100644 index 39d4feb..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentidimpact.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDImpactRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PatchV1IncidentsIncidentIDImpact shared.PatchV1IncidentsIncidentIDImpact `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentsIncidentIDImpactRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDImpactRequest) GetPatchV1IncidentsIncidentIDImpact() shared.PatchV1IncidentsIncidentIDImpact { - if o == nil { - return shared.PatchV1IncidentsIncidentIDImpact{} - } - return o.PatchV1IncidentsIncidentIDImpact -} - -type PatchV1IncidentsIncidentIDImpactResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Allows updating an incident's impacted infrastructure, with the option to - // move the incident into a different milestone and provide a note to update - // the incident timeline and any attached status pages. If this method is - // requested with the PUT verb, impacts will be completely replaced with the - // information in the request body, even if not provided (effectively clearing - // all impacts). If this method is requested with the PATCH verb, the provided - // impacts will be added or updated, but no impacts will be removed. - // - IncidentEntity *shared.IncidentEntity -} - -func (o *PatchV1IncidentsIncidentIDImpactResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDImpactResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDImpactResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDImpactResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentidnotesnoteid.go b/internal/sdk/models/operations/patchv1incidentsincidentidnotesnoteid.go deleted file mode 100644 index e238d13..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentidnotesnoteid.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDNotesNoteIDRequest struct { - NoteID string `pathParam:"style=simple,explode=false,name=note_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PatchV1IncidentsIncidentIDNotesNoteID shared.PatchV1IncidentsIncidentIDNotesNoteID `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentsIncidentIDNotesNoteIDRequest) GetNoteID() string { - if o == nil { - return "" - } - return o.NoteID -} - -func (o *PatchV1IncidentsIncidentIDNotesNoteIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDNotesNoteIDRequest) GetPatchV1IncidentsIncidentIDNotesNoteID() shared.PatchV1IncidentsIncidentIDNotesNoteID { - if o == nil { - return shared.PatchV1IncidentsIncidentIDNotesNoteID{} - } - return o.PatchV1IncidentsIncidentIDNotesNoteID -} - -type PatchV1IncidentsIncidentIDNotesNoteIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Updates the body of a note - EventNoteEntity *shared.EventNoteEntity -} - -func (o *PatchV1IncidentsIncidentIDNotesNoteIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDNotesNoteIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDNotesNoteIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDNotesNoteIDResponse) GetEventNoteEntity() *shared.EventNoteEntity { - if o == nil { - return nil - } - return o.EventNoteEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentidrelatedchangeeventsrelatedchangeeventid.go b/internal/sdk/models/operations/patchv1incidentsincidentidrelatedchangeeventsrelatedchangeeventid.go deleted file mode 100644 index 3819a16..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentidrelatedchangeeventsrelatedchangeeventid.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDRequest struct { - RelatedChangeEventID string `pathParam:"style=simple,explode=false,name=related_change_event_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID shared.PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDRequest) GetRelatedChangeEventID() string { - if o == nil { - return "" - } - return o.RelatedChangeEventID -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDRequest) GetPatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID() shared.PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID { - if o == nil { - return shared.PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID{} - } - return o.PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID -} - -type PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a change attached to an incident - IncidentsRelatedChangeEventEntity *shared.IncidentsRelatedChangeEventEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDResponse) GetIncidentsRelatedChangeEventEntity() *shared.IncidentsRelatedChangeEventEntity { - if o == nil { - return nil - } - return o.IncidentsRelatedChangeEventEntity -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/patchv1incidentsincidentidtaskstaskid.go b/internal/sdk/models/operations/patchv1incidentsincidentidtaskstaskid.go deleted file mode 100644 index 0fc08be..0000000 --- a/internal/sdk/models/operations/patchv1incidentsincidentidtaskstaskid.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentsIncidentIDTasksTaskIDRequest struct { - TaskID string `pathParam:"style=simple,explode=false,name=task_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PatchV1IncidentsIncidentIDTasksTaskID shared.PatchV1IncidentsIncidentIDTasksTaskID `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskIDRequest) GetTaskID() string { - if o == nil { - return "" - } - return o.TaskID -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskIDRequest) GetPatchV1IncidentsIncidentIDTasksTaskID() shared.PatchV1IncidentsIncidentIDTasksTaskID { - if o == nil { - return shared.PatchV1IncidentsIncidentIDTasksTaskID{} - } - return o.PatchV1IncidentsIncidentIDTasksTaskID -} - -type PatchV1IncidentsIncidentIDTasksTaskIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a task's attributes - TaskEntity *shared.TaskEntity -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskIDResponse) GetTaskEntity() *shared.TaskEntity { - if o == nil { - return nil - } - return o.TaskEntity -} diff --git a/internal/sdk/models/operations/patchv1incidenttypesid.go b/internal/sdk/models/operations/patchv1incidenttypesid.go deleted file mode 100644 index ff398c4..0000000 --- a/internal/sdk/models/operations/patchv1incidenttypesid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IncidentTypesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1IncidentTypesID shared.PatchV1IncidentTypesID `request:"mediaType=application/json"` -} - -func (o *PatchV1IncidentTypesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1IncidentTypesIDRequest) GetPatchV1IncidentTypesID() shared.PatchV1IncidentTypesID { - if o == nil { - return shared.PatchV1IncidentTypesID{} - } - return o.PatchV1IncidentTypesID -} - -type PatchV1IncidentTypesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a single incident type from its ID - IncidentTypeEntity *shared.IncidentTypeEntity -} - -func (o *PatchV1IncidentTypesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IncidentTypesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IncidentTypesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IncidentTypesIDResponse) GetIncidentTypeEntity() *shared.IncidentTypeEntity { - if o == nil { - return nil - } - return o.IncidentTypeEntity -} diff --git a/internal/sdk/models/operations/patchv1integrationsawscloudtrailbatchesid.go b/internal/sdk/models/operations/patchv1integrationsawscloudtrailbatchesid.go deleted file mode 100644 index 83b996b..0000000 --- a/internal/sdk/models/operations/patchv1integrationsawscloudtrailbatchesid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IntegrationsAwsCloudtrailBatchesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1IntegrationsAwsCloudtrailBatchesID shared.PatchV1IntegrationsAwsCloudtrailBatchesID `request:"mediaType=application/json"` -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesIDRequest) GetPatchV1IntegrationsAwsCloudtrailBatchesID() shared.PatchV1IntegrationsAwsCloudtrailBatchesID { - if o == nil { - return shared.PatchV1IntegrationsAwsCloudtrailBatchesID{} - } - return o.PatchV1IntegrationsAwsCloudtrailBatchesID -} - -type PatchV1IntegrationsAwsCloudtrailBatchesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a CloudTrail batch with new information. - IntegrationsAwsCloudtrailBatchEntity *shared.IntegrationsAwsCloudtrailBatchEntity -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesIDResponse) GetIntegrationsAwsCloudtrailBatchEntity() *shared.IntegrationsAwsCloudtrailBatchEntity { - if o == nil { - return nil - } - return o.IntegrationsAwsCloudtrailBatchEntity -} diff --git a/internal/sdk/models/operations/patchv1integrationsawsconnectionsid.go b/internal/sdk/models/operations/patchv1integrationsawsconnectionsid.go deleted file mode 100644 index 5d4563a..0000000 --- a/internal/sdk/models/operations/patchv1integrationsawsconnectionsid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IntegrationsAwsConnectionsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1IntegrationsAwsConnectionsID shared.PatchV1IntegrationsAwsConnectionsID `request:"mediaType=application/json"` -} - -func (o *PatchV1IntegrationsAwsConnectionsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1IntegrationsAwsConnectionsIDRequest) GetPatchV1IntegrationsAwsConnectionsID() shared.PatchV1IntegrationsAwsConnectionsID { - if o == nil { - return shared.PatchV1IntegrationsAwsConnectionsID{} - } - return o.PatchV1IntegrationsAwsConnectionsID -} - -type PatchV1IntegrationsAwsConnectionsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update the AWS connection with the provided data. - IntegrationsAwsConnectionEntity *shared.IntegrationsAwsConnectionEntity -} - -func (o *PatchV1IntegrationsAwsConnectionsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IntegrationsAwsConnectionsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IntegrationsAwsConnectionsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IntegrationsAwsConnectionsIDResponse) GetIntegrationsAwsConnectionEntity() *shared.IntegrationsAwsConnectionEntity { - if o == nil { - return nil - } - return o.IntegrationsAwsConnectionEntity -} diff --git a/internal/sdk/models/operations/patchv1integrationsconnectionsslugconnectionid.go b/internal/sdk/models/operations/patchv1integrationsconnectionsslugconnectionid.go deleted file mode 100644 index 65475cc..0000000 --- a/internal/sdk/models/operations/patchv1integrationsconnectionsslugconnectionid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PatchV1IntegrationsConnectionsSlugConnectionIDRequest struct { - Slug string `pathParam:"style=simple,explode=false,name=slug"` - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDRequest) GetSlug() string { - if o == nil { - return "" - } - return o.Slug -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -type PatchV1IntegrationsConnectionsSlugConnectionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1integrationsconnectionsslugconnectionidrefresh.go b/internal/sdk/models/operations/patchv1integrationsconnectionsslugconnectionidrefresh.go deleted file mode 100644 index 8c8cc07..0000000 --- a/internal/sdk/models/operations/patchv1integrationsconnectionsslugconnectionidrefresh.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PatchV1IntegrationsConnectionsSlugConnectionIDRefreshRequest struct { - Slug string `pathParam:"style=simple,explode=false,name=slug"` - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDRefreshRequest) GetSlug() string { - if o == nil { - return "" - } - return o.Slug -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDRefreshRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -type PatchV1IntegrationsConnectionsSlugConnectionIDRefreshResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDRefreshResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDRefreshResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IntegrationsConnectionsSlugConnectionIDRefreshResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1integrationsfieldmapsfieldmapid.go b/internal/sdk/models/operations/patchv1integrationsfieldmapsfieldmapid.go deleted file mode 100644 index af81854..0000000 --- a/internal/sdk/models/operations/patchv1integrationsfieldmapsfieldmapid.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IntegrationsFieldMapsFieldMapIDRequest struct { - FieldMapID string `pathParam:"style=simple,explode=false,name=field_map_id"` -} - -func (o *PatchV1IntegrationsFieldMapsFieldMapIDRequest) GetFieldMapID() string { - if o == nil { - return "" - } - return o.FieldMapID -} - -type PatchV1IntegrationsFieldMapsFieldMapIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update field map - FieldMappingFieldMapEntity *shared.FieldMappingFieldMapEntity -} - -func (o *PatchV1IntegrationsFieldMapsFieldMapIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IntegrationsFieldMapsFieldMapIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IntegrationsFieldMapsFieldMapIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IntegrationsFieldMapsFieldMapIDResponse) GetFieldMappingFieldMapEntity() *shared.FieldMappingFieldMapEntity { - if o == nil { - return nil - } - return o.FieldMappingFieldMapEntity -} diff --git a/internal/sdk/models/operations/patchv1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go b/internal/sdk/models/operations/patchv1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go deleted file mode 100644 index 736c746..0000000 --- a/internal/sdk/models/operations/patchv1integrationsslackconnectionsconnectionidemojiactionsemojiactionid.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequestBody struct { - // The name of the emoji to associate with this action - EmojiName *string `form:"name=emoji_name"` - // The ID of the incident type to associate with this emoji action - IncidentTypeID *string `form:"name=incident_type_id"` -} - -func (o *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequestBody) GetEmojiName() *string { - if o == nil { - return nil - } - return o.EmojiName -} - -func (o *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequestBody) GetIncidentTypeID() *string { - if o == nil { - return nil - } - return o.IncidentTypeID -} - -type PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest struct { - // Slack Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` - EmojiActionID string `pathParam:"style=simple,explode=false,name=emoji_action_id"` - RequestBody *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -func (o *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest) GetEmojiActionID() string { - if o == nil { - return "" - } - return o.EmojiActionID -} - -func (o *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequest) GetRequestBody() *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IntegrationsSlackConnectionsConnectionIDEmojiActionsEmojiActionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1integrationsstatuspageconnectionsconnectionid.go b/internal/sdk/models/operations/patchv1integrationsstatuspageconnectionsconnectionid.go deleted file mode 100644 index 0038c78..0000000 --- a/internal/sdk/models/operations/patchv1integrationsstatuspageconnectionsconnectionid.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1IntegrationsStatuspageConnectionsConnectionIDRequest struct { - // Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` - PatchV1IntegrationsStatuspageConnectionsConnectionID shared.PatchV1IntegrationsStatuspageConnectionsConnectionID `request:"mediaType=application/json"` -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionIDRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionIDRequest) GetPatchV1IntegrationsStatuspageConnectionsConnectionID() shared.PatchV1IntegrationsStatuspageConnectionsConnectionID { - if o == nil { - return shared.PatchV1IntegrationsStatuspageConnectionsConnectionID{} - } - return o.PatchV1IntegrationsStatuspageConnectionsConnectionID -} - -type PatchV1IntegrationsStatuspageConnectionsConnectionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update the given Statuspage integration connection. - IntegrationsStatuspageConnectionEntity *shared.IntegrationsStatuspageConnectionEntity -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionIDResponse) GetIntegrationsStatuspageConnectionEntity() *shared.IntegrationsStatuspageConnectionEntity { - if o == nil { - return nil - } - return o.IntegrationsStatuspageConnectionEntity -} diff --git a/internal/sdk/models/operations/patchv1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go b/internal/sdk/models/operations/patchv1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go deleted file mode 100644 index 3e16095..0000000 --- a/internal/sdk/models/operations/patchv1lifecyclesmeasurementdefinitionsmeasurementdefinitionid.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequestBody struct { - Name *string `form:"name=name"` - Slug *string `form:"name=slug"` - Description *string `form:"name=description"` - StartsAtMilestoneID *string `form:"name=starts_at_milestone_id"` - EndsAtMilestoneID *string `form:"name=ends_at_milestone_id"` -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequestBody) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequestBody) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequestBody) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequestBody) GetStartsAtMilestoneID() *string { - if o == nil { - return nil - } - return o.StartsAtMilestoneID -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequestBody) GetEndsAtMilestoneID() *string { - if o == nil { - return nil - } - return o.EndsAtMilestoneID -} - -type PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest struct { - MeasurementDefinitionID string `pathParam:"style=simple,explode=false,name=measurement_definition_id"` - RequestBody *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest) GetMeasurementDefinitionID() string { - if o == nil { - return "" - } - return o.MeasurementDefinitionID -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequest) GetRequestBody() *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1LifecyclesMeasurementDefinitionsMeasurementDefinitionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1lifecyclesmilestonesmilestoneid.go b/internal/sdk/models/operations/patchv1lifecyclesmilestonesmilestoneid.go deleted file mode 100644 index f3a3745..0000000 --- a/internal/sdk/models/operations/patchv1lifecyclesmilestonesmilestoneid.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1LifecyclesMilestonesMilestoneIDRequestBody struct { - // The name of the milestone - Name *string `form:"name=name"` - // A long-form description of the milestone's purpose - Description *string `form:"name=description"` - // A unique identifier for the milestone. If not provided, one will be generated from the name. - Slug *string `form:"name=slug"` - // The position of the milestone within the phase. If not provided, the milestone will be added as the last milestone in the phase. - Position *int `form:"name=position"` - // The ID of a later milestone that cannot be started until this milestone has a timestamp populated - RequiredAtMilestoneID *string `form:"name=required_at_milestone_id"` -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDRequestBody) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDRequestBody) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDRequestBody) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDRequestBody) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDRequestBody) GetRequiredAtMilestoneID() *string { - if o == nil { - return nil - } - return o.RequiredAtMilestoneID -} - -type PatchV1LifecyclesMilestonesMilestoneIDRequest struct { - MilestoneID string `pathParam:"style=simple,explode=false,name=milestone_id"` - RequestBody *PatchV1LifecyclesMilestonesMilestoneIDRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDRequest) GetMilestoneID() string { - if o == nil { - return "" - } - return o.MilestoneID -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDRequest) GetRequestBody() *PatchV1LifecyclesMilestonesMilestoneIDRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type PatchV1LifecyclesMilestonesMilestoneIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a milestone - LifecyclesPhaseEntity *shared.LifecyclesPhaseEntity -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1LifecyclesMilestonesMilestoneIDResponse) GetLifecyclesPhaseEntity() *shared.LifecyclesPhaseEntity { - if o == nil { - return nil - } - return o.LifecyclesPhaseEntity -} diff --git a/internal/sdk/models/operations/patchv1nuncconnectionsnuncconnectionidcomponentgroupsgroupid.go b/internal/sdk/models/operations/patchv1nuncconnectionsnuncconnectionidcomponentgroupsgroupid.go deleted file mode 100644 index 39f04f4..0000000 --- a/internal/sdk/models/operations/patchv1nuncconnectionsnuncconnectionidcomponentgroupsgroupid.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequestBody struct { - Name *string `form:"name=name"` - ComponentGroupID *string `form:"name=component_group_id"` - Position *int `form:"name=position"` -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequestBody) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequestBody) GetComponentGroupID() *string { - if o == nil { - return nil - } - return o.ComponentGroupID -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequestBody) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -type PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - GroupID string `pathParam:"style=simple,explode=false,name=group_id"` - RequestBody *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest) GetGroupID() string { - if o == nil { - return "" - } - return o.GroupID -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest) GetRequestBody() *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1nuncconnectionsnuncconnectionidlinkslinkid.go b/internal/sdk/models/operations/patchv1nuncconnectionsnuncconnectionidlinkslinkid.go deleted file mode 100644 index 0ba9572..0000000 --- a/internal/sdk/models/operations/patchv1nuncconnectionsnuncconnectionidlinkslinkid.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - LinkID string `pathParam:"style=simple,explode=false,name=link_id"` - PatchV1NuncConnectionsNuncConnectionIDLinksLinkID shared.PatchV1NuncConnectionsNuncConnectionIDLinksLinkID `request:"mediaType=application/json"` -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest) GetLinkID() string { - if o == nil { - return "" - } - return o.LinkID -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest) GetPatchV1NuncConnectionsNuncConnectionIDLinksLinkID() shared.PatchV1NuncConnectionsNuncConnectionIDLinksLinkID { - if o == nil { - return shared.PatchV1NuncConnectionsNuncConnectionIDLinksLinkID{} - } - return o.PatchV1NuncConnectionsNuncConnectionIDLinksLinkID -} - -type PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1postmortemsreportsreportid.go b/internal/sdk/models/operations/patchv1postmortemsreportsreportid.go deleted file mode 100644 index e1c7da6..0000000 --- a/internal/sdk/models/operations/patchv1postmortemsreportsreportid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1PostMortemsReportsReportIDRequest struct { - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` - PatchV1PostMortemsReportsReportID shared.PatchV1PostMortemsReportsReportID `request:"mediaType=application/json"` -} - -func (o *PatchV1PostMortemsReportsReportIDRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -func (o *PatchV1PostMortemsReportsReportIDRequest) GetPatchV1PostMortemsReportsReportID() shared.PatchV1PostMortemsReportsReportID { - if o == nil { - return shared.PatchV1PostMortemsReportsReportID{} - } - return o.PatchV1PostMortemsReportsReportID -} - -type PatchV1PostMortemsReportsReportIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a report - PostMortemsPostMortemReportEntity *shared.PostMortemsPostMortemReportEntity -} - -func (o *PatchV1PostMortemsReportsReportIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1PostMortemsReportsReportIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1PostMortemsReportsReportIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1PostMortemsReportsReportIDResponse) GetPostMortemsPostMortemReportEntity() *shared.PostMortemsPostMortemReportEntity { - if o == nil { - return nil - } - return o.PostMortemsPostMortemReportEntity -} diff --git a/internal/sdk/models/operations/patchv1postmortemsreportsreportidfieldsfieldid.go b/internal/sdk/models/operations/patchv1postmortemsreportsreportidfieldsfieldid.go deleted file mode 100644 index 34f7cca..0000000 --- a/internal/sdk/models/operations/patchv1postmortemsreportsreportidfieldsfieldid.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1PostMortemsReportsReportIDFieldsFieldIDRequest struct { - FieldID string `pathParam:"style=simple,explode=false,name=field_id"` - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` - PatchV1PostMortemsReportsReportIDFieldsFieldID shared.PatchV1PostMortemsReportsReportIDFieldsFieldID `request:"mediaType=application/json"` -} - -func (o *PatchV1PostMortemsReportsReportIDFieldsFieldIDRequest) GetFieldID() string { - if o == nil { - return "" - } - return o.FieldID -} - -func (o *PatchV1PostMortemsReportsReportIDFieldsFieldIDRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -func (o *PatchV1PostMortemsReportsReportIDFieldsFieldIDRequest) GetPatchV1PostMortemsReportsReportIDFieldsFieldID() shared.PatchV1PostMortemsReportsReportIDFieldsFieldID { - if o == nil { - return shared.PatchV1PostMortemsReportsReportIDFieldsFieldID{} - } - return o.PatchV1PostMortemsReportsReportIDFieldsFieldID -} - -type PatchV1PostMortemsReportsReportIDFieldsFieldIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a field value on a post mortem report - PostMortemsSectionFieldEntity *shared.PostMortemsSectionFieldEntity -} - -func (o *PatchV1PostMortemsReportsReportIDFieldsFieldIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1PostMortemsReportsReportIDFieldsFieldIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1PostMortemsReportsReportIDFieldsFieldIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1PostMortemsReportsReportIDFieldsFieldIDResponse) GetPostMortemsSectionFieldEntity() *shared.PostMortemsSectionFieldEntity { - if o == nil { - return nil - } - return o.PostMortemsSectionFieldEntity -} diff --git a/internal/sdk/models/operations/patchv1postmortemsreportsreportidreasonsreasonid.go b/internal/sdk/models/operations/patchv1postmortemsreportsreportidreasonsreasonid.go deleted file mode 100644 index 13b7c8c..0000000 --- a/internal/sdk/models/operations/patchv1postmortemsreportsreportidreasonsreasonid.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1PostMortemsReportsReportIDReasonsReasonIDRequest struct { - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` - ReasonID string `pathParam:"style=simple,explode=false,name=reason_id"` - PatchV1PostMortemsReportsReportIDReasonsReasonID shared.PatchV1PostMortemsReportsReportIDReasonsReasonID `request:"mediaType=application/json"` -} - -func (o *PatchV1PostMortemsReportsReportIDReasonsReasonIDRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -func (o *PatchV1PostMortemsReportsReportIDReasonsReasonIDRequest) GetReasonID() string { - if o == nil { - return "" - } - return o.ReasonID -} - -func (o *PatchV1PostMortemsReportsReportIDReasonsReasonIDRequest) GetPatchV1PostMortemsReportsReportIDReasonsReasonID() shared.PatchV1PostMortemsReportsReportIDReasonsReasonID { - if o == nil { - return shared.PatchV1PostMortemsReportsReportIDReasonsReasonID{} - } - return o.PatchV1PostMortemsReportsReportIDReasonsReasonID -} - -type PatchV1PostMortemsReportsReportIDReasonsReasonIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a contributing factor - PostMortemsReasonEntity *shared.PostMortemsReasonEntity -} - -func (o *PatchV1PostMortemsReportsReportIDReasonsReasonIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1PostMortemsReportsReportIDReasonsReasonIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1PostMortemsReportsReportIDReasonsReasonIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1PostMortemsReportsReportIDReasonsReasonIDResponse) GetPostMortemsReasonEntity() *shared.PostMortemsReasonEntity { - if o == nil { - return nil - } - return o.PostMortemsReasonEntity -} diff --git a/internal/sdk/models/operations/patchv1prioritiespriorityslug.go b/internal/sdk/models/operations/patchv1prioritiespriorityslug.go deleted file mode 100644 index 7c370e8..0000000 --- a/internal/sdk/models/operations/patchv1prioritiespriorityslug.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1PrioritiesPrioritySlugRequest struct { - PrioritySlug string `pathParam:"style=simple,explode=false,name=priority_slug"` - PatchV1PrioritiesPrioritySlug shared.PatchV1PrioritiesPrioritySlug `request:"mediaType=application/json"` -} - -func (o *PatchV1PrioritiesPrioritySlugRequest) GetPrioritySlug() string { - if o == nil { - return "" - } - return o.PrioritySlug -} - -func (o *PatchV1PrioritiesPrioritySlugRequest) GetPatchV1PrioritiesPrioritySlug() shared.PatchV1PrioritiesPrioritySlug { - if o == nil { - return shared.PatchV1PrioritiesPrioritySlug{} - } - return o.PatchV1PrioritiesPrioritySlug -} - -type PatchV1PrioritiesPrioritySlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a specific priority - PriorityEntity *shared.PriorityEntity -} - -func (o *PatchV1PrioritiesPrioritySlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1PrioritiesPrioritySlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1PrioritiesPrioritySlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1PrioritiesPrioritySlugResponse) GetPriorityEntity() *shared.PriorityEntity { - if o == nil { - return nil - } - return o.PriorityEntity -} diff --git a/internal/sdk/models/operations/patchv1runbooksexecutionsexecutionidstepsstepidvotes.go b/internal/sdk/models/operations/patchv1runbooksexecutionsexecutionidstepsstepidvotes.go deleted file mode 100644 index b30f79d..0000000 --- a/internal/sdk/models/operations/patchv1runbooksexecutionsexecutionidstepsstepidvotes.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` - StepID string `pathParam:"style=simple,explode=false,name=step_id"` - PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes shared.PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes `request:"mediaType=application/json"` -} - -func (o *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -func (o *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesRequest) GetStepID() string { - if o == nil { - return "" - } - return o.StepID -} - -func (o *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesRequest) GetPatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes() shared.PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes { - if o == nil { - return shared.PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes{} - } - return o.PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes -} - -type PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Allows for upvoting or downvoting an event - VotesEntity *shared.VotesEntity -} - -func (o *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesResponse) GetVotesEntity() *shared.VotesEntity { - if o == nil { - return nil - } - return o.VotesEntity -} diff --git a/internal/sdk/models/operations/patchv1runbooksexecutionsexecutionidvotes.go b/internal/sdk/models/operations/patchv1runbooksexecutionsexecutionidvotes.go deleted file mode 100644 index 32453a8..0000000 --- a/internal/sdk/models/operations/patchv1runbooksexecutionsexecutionidvotes.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1RunbooksExecutionsExecutionIDVotesRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` - PatchV1RunbooksExecutionsExecutionIDVotes shared.PatchV1RunbooksExecutionsExecutionIDVotes `request:"mediaType=application/json"` -} - -func (o *PatchV1RunbooksExecutionsExecutionIDVotesRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -func (o *PatchV1RunbooksExecutionsExecutionIDVotesRequest) GetPatchV1RunbooksExecutionsExecutionIDVotes() shared.PatchV1RunbooksExecutionsExecutionIDVotes { - if o == nil { - return shared.PatchV1RunbooksExecutionsExecutionIDVotes{} - } - return o.PatchV1RunbooksExecutionsExecutionIDVotes -} - -type PatchV1RunbooksExecutionsExecutionIDVotesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Allows for upvoting or downvoting an event - VotesEntity *shared.VotesEntity -} - -func (o *PatchV1RunbooksExecutionsExecutionIDVotesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1RunbooksExecutionsExecutionIDVotesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1RunbooksExecutionsExecutionIDVotesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1RunbooksExecutionsExecutionIDVotesResponse) GetVotesEntity() *shared.VotesEntity { - if o == nil { - return nil - } - return o.VotesEntity -} diff --git a/internal/sdk/models/operations/patchv1savedsearchesresourcetypesavedsearchid.go b/internal/sdk/models/operations/patchv1savedsearchesresourcetypesavedsearchid.go deleted file mode 100644 index 6ce3827..0000000 --- a/internal/sdk/models/operations/patchv1savedsearchesresourcetypesavedsearchid.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PathParamResourceType string - -const ( - PathParamResourceTypeChangeEvents PathParamResourceType = "change_events" - PathParamResourceTypeIncidents PathParamResourceType = "incidents" - PathParamResourceTypeServices PathParamResourceType = "services" - PathParamResourceTypeScheduledMaintenances PathParamResourceType = "scheduled_maintenances" - PathParamResourceTypeTicketTasks PathParamResourceType = "ticket_tasks" - PathParamResourceTypeTicketFollowUps PathParamResourceType = "ticket_follow_ups" - PathParamResourceTypeAnalytics PathParamResourceType = "analytics" - PathParamResourceTypeImpactAnalytics PathParamResourceType = "impact_analytics" - PathParamResourceTypeAlerts PathParamResourceType = "alerts" - PathParamResourceTypeIncidentEvents PathParamResourceType = "incident_events" -) - -func (e PathParamResourceType) ToPointer() *PathParamResourceType { - return &e -} -func (e *PathParamResourceType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "change_events": - fallthrough - case "incidents": - fallthrough - case "services": - fallthrough - case "scheduled_maintenances": - fallthrough - case "ticket_tasks": - fallthrough - case "ticket_follow_ups": - fallthrough - case "analytics": - fallthrough - case "impact_analytics": - fallthrough - case "alerts": - fallthrough - case "incident_events": - *e = PathParamResourceType(v) - return nil - default: - return fmt.Errorf("invalid value for PathParamResourceType: %v", v) - } -} - -type PatchV1SavedSearchesResourceTypeSavedSearchIDRequest struct { - ResourceType PathParamResourceType `pathParam:"style=simple,explode=false,name=resource_type"` - SavedSearchID string `pathParam:"style=simple,explode=false,name=saved_search_id"` - PatchV1SavedSearchesResourceTypeSavedSearchID shared.PatchV1SavedSearchesResourceTypeSavedSearchID `request:"mediaType=application/json"` -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchIDRequest) GetResourceType() PathParamResourceType { - if o == nil { - return PathParamResourceType("") - } - return o.ResourceType -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchIDRequest) GetSavedSearchID() string { - if o == nil { - return "" - } - return o.SavedSearchID -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchIDRequest) GetPatchV1SavedSearchesResourceTypeSavedSearchID() shared.PatchV1SavedSearchesResourceTypeSavedSearchID { - if o == nil { - return shared.PatchV1SavedSearchesResourceTypeSavedSearchID{} - } - return o.PatchV1SavedSearchesResourceTypeSavedSearchID -} - -type PatchV1SavedSearchesResourceTypeSavedSearchIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a specific saved search - SavedSearchEntity *shared.SavedSearchEntity -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchIDResponse) GetSavedSearchEntity() *shared.SavedSearchEntity { - if o == nil { - return nil - } - return o.SavedSearchEntity -} diff --git a/internal/sdk/models/operations/patchv1scheduledmaintenancesscheduledmaintenanceid.go b/internal/sdk/models/operations/patchv1scheduledmaintenancesscheduledmaintenanceid.go deleted file mode 100644 index e2b847d..0000000 --- a/internal/sdk/models/operations/patchv1scheduledmaintenancesscheduledmaintenanceid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1ScheduledMaintenancesScheduledMaintenanceIDRequest struct { - ScheduledMaintenanceID string `pathParam:"style=simple,explode=false,name=scheduled_maintenance_id"` - PatchV1ScheduledMaintenancesScheduledMaintenanceID shared.PatchV1ScheduledMaintenancesScheduledMaintenanceID `request:"mediaType=application/json"` -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDRequest) GetScheduledMaintenanceID() string { - if o == nil { - return "" - } - return o.ScheduledMaintenanceID -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDRequest) GetPatchV1ScheduledMaintenancesScheduledMaintenanceID() shared.PatchV1ScheduledMaintenancesScheduledMaintenanceID { - if o == nil { - return shared.PatchV1ScheduledMaintenancesScheduledMaintenanceID{} - } - return o.PatchV1ScheduledMaintenancesScheduledMaintenanceID -} - -type PatchV1ScheduledMaintenancesScheduledMaintenanceIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Change the conditions of a scheduled maintenance event, including updating any status page announcements of changes. - ScheduledMaintenanceEntity *shared.ScheduledMaintenanceEntity -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDResponse) GetScheduledMaintenanceEntity() *shared.ScheduledMaintenanceEntity { - if o == nil { - return nil - } - return o.ScheduledMaintenanceEntity -} diff --git a/internal/sdk/models/operations/patchv1servicedependenciesservicedependencyid.go b/internal/sdk/models/operations/patchv1servicedependenciesservicedependencyid.go deleted file mode 100644 index 214846e..0000000 --- a/internal/sdk/models/operations/patchv1servicedependenciesservicedependencyid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1ServiceDependenciesServiceDependencyIDRequest struct { - ServiceDependencyID string `pathParam:"style=simple,explode=false,name=service_dependency_id"` - PatchV1ServiceDependenciesServiceDependencyID shared.PatchV1ServiceDependenciesServiceDependencyID `request:"mediaType=application/json"` -} - -func (o *PatchV1ServiceDependenciesServiceDependencyIDRequest) GetServiceDependencyID() string { - if o == nil { - return "" - } - return o.ServiceDependencyID -} - -func (o *PatchV1ServiceDependenciesServiceDependencyIDRequest) GetPatchV1ServiceDependenciesServiceDependencyID() shared.PatchV1ServiceDependenciesServiceDependencyID { - if o == nil { - return shared.PatchV1ServiceDependenciesServiceDependencyID{} - } - return o.PatchV1ServiceDependenciesServiceDependencyID -} - -type PatchV1ServiceDependenciesServiceDependencyIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update the notes of the service dependency - ServiceDependencyEntity *shared.ServiceDependencyEntity -} - -func (o *PatchV1ServiceDependenciesServiceDependencyIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1ServiceDependenciesServiceDependencyIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1ServiceDependenciesServiceDependencyIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1ServiceDependenciesServiceDependencyIDResponse) GetServiceDependencyEntity() *shared.ServiceDependencyEntity { - if o == nil { - return nil - } - return o.ServiceDependencyEntity -} diff --git a/internal/sdk/models/operations/patchv1servicesserviceid.go b/internal/sdk/models/operations/patchv1servicesserviceid.go deleted file mode 100644 index 7f35559..0000000 --- a/internal/sdk/models/operations/patchv1servicesserviceid.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1ServicesServiceIDRequest struct { - ServiceID string `pathParam:"style=simple,explode=false,name=service_id"` - PatchV1ServicesServiceID shared.PatchV1ServicesServiceID `request:"mediaType=application/json"` -} - -func (o *PatchV1ServicesServiceIDRequest) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -func (o *PatchV1ServicesServiceIDRequest) GetPatchV1ServicesServiceID() shared.PatchV1ServicesServiceID { - if o == nil { - return shared.PatchV1ServicesServiceID{} - } - return o.PatchV1ServicesServiceID -} - -type PatchV1ServicesServiceIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a services attributes, you may also add or remove functionalities from the service as well. - // Note: You may not remove or add individual label key/value pairs. You must include the entire object to override label values. - // - ServiceEntity *shared.ServiceEntity -} - -func (o *PatchV1ServicesServiceIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1ServicesServiceIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1ServicesServiceIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1ServicesServiceIDResponse) GetServiceEntity() *shared.ServiceEntity { - if o == nil { - return nil - } - return o.ServiceEntity -} diff --git a/internal/sdk/models/operations/patchv1severitiesseverityslug.go b/internal/sdk/models/operations/patchv1severitiesseverityslug.go deleted file mode 100644 index ea8949c..0000000 --- a/internal/sdk/models/operations/patchv1severitiesseverityslug.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1SeveritiesSeveritySlugRequest struct { - SeveritySlug string `pathParam:"style=simple,explode=false,name=severity_slug"` - PatchV1SeveritiesSeveritySlug shared.PatchV1SeveritiesSeveritySlug `request:"mediaType=application/json"` -} - -func (o *PatchV1SeveritiesSeveritySlugRequest) GetSeveritySlug() string { - if o == nil { - return "" - } - return o.SeveritySlug -} - -func (o *PatchV1SeveritiesSeveritySlugRequest) GetPatchV1SeveritiesSeveritySlug() shared.PatchV1SeveritiesSeveritySlug { - if o == nil { - return shared.PatchV1SeveritiesSeveritySlug{} - } - return o.PatchV1SeveritiesSeveritySlug -} - -type PatchV1SeveritiesSeveritySlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a specific severity - SeverityEntity *shared.SeverityEntity -} - -func (o *PatchV1SeveritiesSeveritySlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1SeveritiesSeveritySlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1SeveritiesSeveritySlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1SeveritiesSeveritySlugResponse) GetSeverityEntity() *shared.SeverityEntity { - if o == nil { - return nil - } - return o.SeverityEntity -} diff --git a/internal/sdk/models/operations/patchv1severitymatrix.go b/internal/sdk/models/operations/patchv1severitymatrix.go deleted file mode 100644 index 5262c22..0000000 --- a/internal/sdk/models/operations/patchv1severitymatrix.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1SeverityMatrixResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update available severities and impacts in your organization's severity matrix. - SeverityMatrixSeverityMatrixEntity *shared.SeverityMatrixSeverityMatrixEntity -} - -func (o *PatchV1SeverityMatrixResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1SeverityMatrixResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1SeverityMatrixResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1SeverityMatrixResponse) GetSeverityMatrixSeverityMatrixEntity() *shared.SeverityMatrixSeverityMatrixEntity { - if o == nil { - return nil - } - return o.SeverityMatrixSeverityMatrixEntity -} diff --git a/internal/sdk/models/operations/patchv1severitymatrixconditionsconditionid.go b/internal/sdk/models/operations/patchv1severitymatrixconditionsconditionid.go deleted file mode 100644 index b5d3b59..0000000 --- a/internal/sdk/models/operations/patchv1severitymatrixconditionsconditionid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1SeverityMatrixConditionsConditionIDRequest struct { - ConditionID string `pathParam:"style=simple,explode=false,name=condition_id"` - PatchV1SeverityMatrixConditionsConditionID shared.PatchV1SeverityMatrixConditionsConditionID `request:"mediaType=application/json"` -} - -func (o *PatchV1SeverityMatrixConditionsConditionIDRequest) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -func (o *PatchV1SeverityMatrixConditionsConditionIDRequest) GetPatchV1SeverityMatrixConditionsConditionID() shared.PatchV1SeverityMatrixConditionsConditionID { - if o == nil { - return shared.PatchV1SeverityMatrixConditionsConditionID{} - } - return o.PatchV1SeverityMatrixConditionsConditionID -} - -type PatchV1SeverityMatrixConditionsConditionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a specific condition - SeverityMatrixConditionEntity *shared.SeverityMatrixConditionEntity -} - -func (o *PatchV1SeverityMatrixConditionsConditionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1SeverityMatrixConditionsConditionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1SeverityMatrixConditionsConditionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1SeverityMatrixConditionsConditionIDResponse) GetSeverityMatrixConditionEntity() *shared.SeverityMatrixConditionEntity { - if o == nil { - return nil - } - return o.SeverityMatrixConditionEntity -} diff --git a/internal/sdk/models/operations/patchv1severitymatriximpactsimpactid.go b/internal/sdk/models/operations/patchv1severitymatriximpactsimpactid.go deleted file mode 100644 index acfd5cd..0000000 --- a/internal/sdk/models/operations/patchv1severitymatriximpactsimpactid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1SeverityMatrixImpactsImpactIDRequest struct { - ImpactID string `pathParam:"style=simple,explode=false,name=impact_id"` - PatchV1SeverityMatrixImpactsImpactID shared.PatchV1SeverityMatrixImpactsImpactID `request:"mediaType=application/json"` -} - -func (o *PatchV1SeverityMatrixImpactsImpactIDRequest) GetImpactID() string { - if o == nil { - return "" - } - return o.ImpactID -} - -func (o *PatchV1SeverityMatrixImpactsImpactIDRequest) GetPatchV1SeverityMatrixImpactsImpactID() shared.PatchV1SeverityMatrixImpactsImpactID { - if o == nil { - return shared.PatchV1SeverityMatrixImpactsImpactID{} - } - return o.PatchV1SeverityMatrixImpactsImpactID -} - -type PatchV1SeverityMatrixImpactsImpactIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a specific impact - SeverityMatrixImpactEntity *shared.SeverityMatrixImpactEntity -} - -func (o *PatchV1SeverityMatrixImpactsImpactIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1SeverityMatrixImpactsImpactIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1SeverityMatrixImpactsImpactIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1SeverityMatrixImpactsImpactIDResponse) GetSeverityMatrixImpactEntity() *shared.SeverityMatrixImpactEntity { - if o == nil { - return nil - } - return o.SeverityMatrixImpactEntity -} diff --git a/internal/sdk/models/operations/patchv1signalsemailtargetsid.go b/internal/sdk/models/operations/patchv1signalsemailtargetsid.go deleted file mode 100644 index 8d1b41d..0000000 --- a/internal/sdk/models/operations/patchv1signalsemailtargetsid.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1SignalsEmailTargetsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1SignalsEmailTargetsID shared.PatchV1SignalsEmailTargetsID `request:"mediaType=application/json"` -} - -func (o *PatchV1SignalsEmailTargetsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1SignalsEmailTargetsIDRequest) GetPatchV1SignalsEmailTargetsID() shared.PatchV1SignalsEmailTargetsID { - if o == nil { - return shared.PatchV1SignalsEmailTargetsID{} - } - return o.PatchV1SignalsEmailTargetsID -} - -type PatchV1SignalsEmailTargetsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1SignalsEmailTargetsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1SignalsEmailTargetsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1SignalsEmailTargetsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1signalswebhooktargetsid.go b/internal/sdk/models/operations/patchv1signalswebhooktargetsid.go deleted file mode 100644 index 249c17c..0000000 --- a/internal/sdk/models/operations/patchv1signalswebhooktargetsid.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1SignalsWebhookTargetsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1SignalsWebhookTargetsID shared.PatchV1SignalsWebhookTargetsID `request:"mediaType=application/json"` -} - -func (o *PatchV1SignalsWebhookTargetsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1SignalsWebhookTargetsIDRequest) GetPatchV1SignalsWebhookTargetsID() shared.PatchV1SignalsWebhookTargetsID { - if o == nil { - return shared.PatchV1SignalsWebhookTargetsID{} - } - return o.PatchV1SignalsWebhookTargetsID -} - -type PatchV1SignalsWebhookTargetsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1SignalsWebhookTargetsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1SignalsWebhookTargetsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1SignalsWebhookTargetsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1statusupdatetemplatesstatusupdatetemplateid.go b/internal/sdk/models/operations/patchv1statusupdatetemplatesstatusupdatetemplateid.go deleted file mode 100644 index 66b5e27..0000000 --- a/internal/sdk/models/operations/patchv1statusupdatetemplatesstatusupdatetemplateid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest struct { - StatusUpdateTemplateID string `pathParam:"style=simple,explode=false,name=status_update_template_id"` - PatchV1StatusUpdateTemplatesStatusUpdateTemplateID shared.PatchV1StatusUpdateTemplatesStatusUpdateTemplateID `request:"mediaType=application/json"` -} - -func (o *PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest) GetStatusUpdateTemplateID() string { - if o == nil { - return "" - } - return o.StatusUpdateTemplateID -} - -func (o *PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest) GetPatchV1StatusUpdateTemplatesStatusUpdateTemplateID() shared.PatchV1StatusUpdateTemplatesStatusUpdateTemplateID { - if o == nil { - return shared.PatchV1StatusUpdateTemplatesStatusUpdateTemplateID{} - } - return o.PatchV1StatusUpdateTemplatesStatusUpdateTemplateID -} - -type PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a single status update template - StatusUpdateTemplateEntity *shared.StatusUpdateTemplateEntity -} - -func (o *PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse) GetStatusUpdateTemplateEntity() *shared.StatusUpdateTemplateEntity { - if o == nil { - return nil - } - return o.StatusUpdateTemplateEntity -} diff --git a/internal/sdk/models/operations/patchv1taskliststasklistid.go b/internal/sdk/models/operations/patchv1taskliststasklistid.go deleted file mode 100644 index 3b093ea..0000000 --- a/internal/sdk/models/operations/patchv1taskliststasklistid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TaskListsTaskListIDRequest struct { - TaskListID string `pathParam:"style=simple,explode=false,name=task_list_id"` - PatchV1TaskListsTaskListID shared.PatchV1TaskListsTaskListID `request:"mediaType=application/json"` -} - -func (o *PatchV1TaskListsTaskListIDRequest) GetTaskListID() string { - if o == nil { - return "" - } - return o.TaskListID -} - -func (o *PatchV1TaskListsTaskListIDRequest) GetPatchV1TaskListsTaskListID() shared.PatchV1TaskListsTaskListID { - if o == nil { - return shared.PatchV1TaskListsTaskListID{} - } - return o.PatchV1TaskListsTaskListID -} - -type PatchV1TaskListsTaskListIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Updates a task list's attributes and task list items - TaskListEntity *shared.TaskListEntity -} - -func (o *PatchV1TaskListsTaskListIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TaskListsTaskListIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TaskListsTaskListIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1TaskListsTaskListIDResponse) GetTaskListEntity() *shared.TaskListEntity { - if o == nil { - return nil - } - return o.TaskListEntity -} diff --git a/internal/sdk/models/operations/patchv1teamsteamid.go b/internal/sdk/models/operations/patchv1teamsteamid.go deleted file mode 100644 index 29481e1..0000000 --- a/internal/sdk/models/operations/patchv1teamsteamid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TeamsTeamIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - PatchV1TeamsTeamID shared.PatchV1TeamsTeamID `request:"mediaType=application/json"` -} - -func (o *PatchV1TeamsTeamIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PatchV1TeamsTeamIDRequest) GetPatchV1TeamsTeamID() shared.PatchV1TeamsTeamID { - if o == nil { - return shared.PatchV1TeamsTeamID{} - } - return o.PatchV1TeamsTeamID -} - -type PatchV1TeamsTeamIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a single team from its ID - TeamEntity *shared.TeamEntity -} - -func (o *PatchV1TeamsTeamIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TeamsTeamIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TeamsTeamIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1TeamsTeamIDResponse) GetTeamEntity() *shared.TeamEntity { - if o == nil { - return nil - } - return o.TeamEntity -} diff --git a/internal/sdk/models/operations/patchv1teamsteamidescalationpoliciesid.go b/internal/sdk/models/operations/patchv1teamsteamidescalationpoliciesid.go deleted file mode 100644 index d43c1c3..0000000 --- a/internal/sdk/models/operations/patchv1teamsteamidescalationpoliciesid.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TeamsTeamIDEscalationPoliciesIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1TeamsTeamIDEscalationPoliciesID shared.PatchV1TeamsTeamIDEscalationPoliciesID `request:"mediaType=application/json"` -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDRequest) GetPatchV1TeamsTeamIDEscalationPoliciesID() shared.PatchV1TeamsTeamIDEscalationPoliciesID { - if o == nil { - return shared.PatchV1TeamsTeamIDEscalationPoliciesID{} - } - return o.PatchV1TeamsTeamIDEscalationPoliciesID -} - -type PatchV1TeamsTeamIDEscalationPoliciesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1teamsteamidoncallschedulesscheduleid.go b/internal/sdk/models/operations/patchv1teamsteamidoncallschedulesscheduleid.go deleted file mode 100644 index 74c44bf..0000000 --- a/internal/sdk/models/operations/patchv1teamsteamidoncallschedulesscheduleid.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ScheduleID string `pathParam:"style=simple,explode=false,name=schedule_id"` - PatchV1TeamsTeamIDOnCallSchedulesScheduleID shared.PatchV1TeamsTeamIDOnCallSchedulesScheduleID `request:"mediaType=application/json"` -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRequest) GetScheduleID() string { - if o == nil { - return "" - } - return o.ScheduleID -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRequest) GetPatchV1TeamsTeamIDOnCallSchedulesScheduleID() shared.PatchV1TeamsTeamIDOnCallSchedulesScheduleID { - if o == nil { - return shared.PatchV1TeamsTeamIDOnCallSchedulesScheduleID{} - } - return o.PatchV1TeamsTeamIDOnCallSchedulesScheduleID -} - -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1teamsteamidoncallschedulesscheduleidshiftsid.go b/internal/sdk/models/operations/patchv1teamsteamidoncallschedulesscheduleidshiftsid.go deleted file mode 100644 index c93795a..0000000 --- a/internal/sdk/models/operations/patchv1teamsteamidoncallschedulesscheduleidshiftsid.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ScheduleID string `pathParam:"style=simple,explode=false,name=schedule_id"` - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID shared.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID `request:"mediaType=application/json"` -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetScheduleID() string { - if o == nil { - return "" - } - return o.ScheduleID -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest) GetPatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID() shared.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID { - if o == nil { - return shared.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID{} - } - return o.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID -} - -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1teamsteamidsignalrulesid.go b/internal/sdk/models/operations/patchv1teamsteamidsignalrulesid.go deleted file mode 100644 index 886db72..0000000 --- a/internal/sdk/models/operations/patchv1teamsteamidsignalrulesid.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TeamsTeamIDSignalRulesIDRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1TeamsTeamIDSignalRulesID shared.PatchV1TeamsTeamIDSignalRulesID `request:"mediaType=application/json"` -} - -func (o *PatchV1TeamsTeamIDSignalRulesIDRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PatchV1TeamsTeamIDSignalRulesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1TeamsTeamIDSignalRulesIDRequest) GetPatchV1TeamsTeamIDSignalRulesID() shared.PatchV1TeamsTeamIDSignalRulesID { - if o == nil { - return shared.PatchV1TeamsTeamIDSignalRulesID{} - } - return o.PatchV1TeamsTeamIDSignalRulesID -} - -type PatchV1TeamsTeamIDSignalRulesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PatchV1TeamsTeamIDSignalRulesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TeamsTeamIDSignalRulesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TeamsTeamIDSignalRulesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/patchv1ticketingprioritiesid.go b/internal/sdk/models/operations/patchv1ticketingprioritiesid.go deleted file mode 100644 index 190a5a1..0000000 --- a/internal/sdk/models/operations/patchv1ticketingprioritiesid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TicketingPrioritiesIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PatchV1TicketingPrioritiesID shared.PatchV1TicketingPrioritiesID `request:"mediaType=application/json"` -} - -func (o *PatchV1TicketingPrioritiesIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1TicketingPrioritiesIDRequest) GetPatchV1TicketingPrioritiesID() shared.PatchV1TicketingPrioritiesID { - if o == nil { - return shared.PatchV1TicketingPrioritiesID{} - } - return o.PatchV1TicketingPrioritiesID -} - -type PatchV1TicketingPrioritiesIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a single ticketing priority's attributes - TicketingPriorityEntity *shared.TicketingPriorityEntity -} - -func (o *PatchV1TicketingPrioritiesIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TicketingPrioritiesIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TicketingPrioritiesIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1TicketingPrioritiesIDResponse) GetTicketingPriorityEntity() *shared.TicketingPriorityEntity { - if o == nil { - return nil - } - return o.TicketingPriorityEntity -} diff --git a/internal/sdk/models/operations/patchv1ticketingprojectsticketingprojectidfieldmapsmapid.go b/internal/sdk/models/operations/patchv1ticketingprojectsticketingprojectidfieldmapsmapid.go deleted file mode 100644 index 57bc26f..0000000 --- a/internal/sdk/models/operations/patchv1ticketingprojectsticketingprojectidfieldmapsmapid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest struct { - MapID string `pathParam:"style=simple,explode=false,name=map_id"` - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest) GetMapID() string { - if o == nil { - return "" - } - return o.MapID -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update field map for a ticketing project - TicketingProjectFieldMapEntity *shared.TicketingProjectFieldMapEntity -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse) GetTicketingProjectFieldMapEntity() *shared.TicketingProjectFieldMapEntity { - if o == nil { - return nil - } - return o.TicketingProjectFieldMapEntity -} diff --git a/internal/sdk/models/operations/patchv1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go b/internal/sdk/models/operations/patchv1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go deleted file mode 100644 index f24d7e3..0000000 --- a/internal/sdk/models/operations/patchv1ticketingprojectsticketingprojectidproviderprojectconfigurationsconfigid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest struct { - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` - ConfigID string `pathParam:"style=simple,explode=false,name=config_id"` -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest) GetConfigID() string { - if o == nil { - return "" - } - return o.ConfigID -} - -type PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update configuration for a ticketing project - TicketingProjectConfigEntity *shared.TicketingProjectConfigEntity -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse) GetTicketingProjectConfigEntity() *shared.TicketingProjectConfigEntity { - if o == nil { - return nil - } - return o.TicketingProjectConfigEntity -} diff --git a/internal/sdk/models/operations/patchv1ticketingticketsticketid.go b/internal/sdk/models/operations/patchv1ticketingticketsticketid.go deleted file mode 100644 index e699d0c..0000000 --- a/internal/sdk/models/operations/patchv1ticketingticketsticketid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1TicketingTicketsTicketIDRequest struct { - TicketID string `pathParam:"style=simple,explode=false,name=ticket_id"` - PatchV1TicketingTicketsTicketID shared.PatchV1TicketingTicketsTicketID `request:"mediaType=application/json"` -} - -func (o *PatchV1TicketingTicketsTicketIDRequest) GetTicketID() string { - if o == nil { - return "" - } - return o.TicketID -} - -func (o *PatchV1TicketingTicketsTicketIDRequest) GetPatchV1TicketingTicketsTicketID() shared.PatchV1TicketingTicketsTicketID { - if o == nil { - return shared.PatchV1TicketingTicketsTicketID{} - } - return o.PatchV1TicketingTicketsTicketID -} - -type PatchV1TicketingTicketsTicketIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a ticket's attributes - TicketingTicketEntity *shared.TicketingTicketEntity -} - -func (o *PatchV1TicketingTicketsTicketIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1TicketingTicketsTicketIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1TicketingTicketsTicketIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1TicketingTicketsTicketIDResponse) GetTicketingTicketEntity() *shared.TicketingTicketEntity { - if o == nil { - return nil - } - return o.TicketingTicketEntity -} diff --git a/internal/sdk/models/operations/patchv1webhookswebhookid.go b/internal/sdk/models/operations/patchv1webhookswebhookid.go deleted file mode 100644 index 235c5b2..0000000 --- a/internal/sdk/models/operations/patchv1webhookswebhookid.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PatchV1WebhooksWebhookIDRequest struct { - WebhookID string `pathParam:"style=simple,explode=false,name=webhook_id"` - PatchV1WebhooksWebhookID shared.PatchV1WebhooksWebhookID `request:"mediaType=application/json"` -} - -func (o *PatchV1WebhooksWebhookIDRequest) GetWebhookID() string { - if o == nil { - return "" - } - return o.WebhookID -} - -func (o *PatchV1WebhooksWebhookIDRequest) GetPatchV1WebhooksWebhookID() shared.PatchV1WebhooksWebhookID { - if o == nil { - return shared.PatchV1WebhooksWebhookID{} - } - return o.PatchV1WebhooksWebhookID -} - -type PatchV1WebhooksWebhookIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a specific webhook - WebhooksEntitiesWebhookEntity *shared.WebhooksEntitiesWebhookEntity -} - -func (o *PatchV1WebhooksWebhookIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PatchV1WebhooksWebhookIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PatchV1WebhooksWebhookIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PatchV1WebhooksWebhookIDResponse) GetWebhooksEntitiesWebhookEntity() *shared.WebhooksEntitiesWebhookEntity { - if o == nil { - return nil - } - return o.WebhooksEntitiesWebhookEntity -} diff --git a/internal/sdk/models/operations/postv1catalogscatalogidingest.go b/internal/sdk/models/operations/postv1catalogscatalogidingest.go deleted file mode 100644 index b0ca016..0000000 --- a/internal/sdk/models/operations/postv1catalogscatalogidingest.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1CatalogsCatalogIDIngestRequest struct { - CatalogID string `pathParam:"style=simple,explode=false,name=catalog_id"` - PostV1CatalogsCatalogIDIngest shared.PostV1CatalogsCatalogIDIngest `request:"mediaType=application/json"` -} - -func (o *PostV1CatalogsCatalogIDIngestRequest) GetCatalogID() string { - if o == nil { - return "" - } - return o.CatalogID -} - -func (o *PostV1CatalogsCatalogIDIngestRequest) GetPostV1CatalogsCatalogIDIngest() shared.PostV1CatalogsCatalogIDIngest { - if o == nil { - return shared.PostV1CatalogsCatalogIDIngest{} - } - return o.PostV1CatalogsCatalogIDIngest -} - -type PostV1CatalogsCatalogIDIngestResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Accepts catalog data in the configured format and asyncronously processes the data to incorporate changes into service catalog. - ImportsImportEntity *shared.ImportsImportEntity -} - -func (o *PostV1CatalogsCatalogIDIngestResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1CatalogsCatalogIDIngestResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1CatalogsCatalogIDIngestResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1CatalogsCatalogIDIngestResponse) GetImportsImportEntity() *shared.ImportsImportEntity { - if o == nil { - return nil - } - return o.ImportsImportEntity -} diff --git a/internal/sdk/models/operations/postv1changes.go b/internal/sdk/models/operations/postv1changes.go deleted file mode 100644 index 8e5986c..0000000 --- a/internal/sdk/models/operations/postv1changes.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ChangesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new change entry - ChangeEntity *shared.ChangeEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PostV1ChangesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ChangesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ChangesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1ChangesResponse) GetChangeEntity() *shared.ChangeEntity { - if o == nil { - return nil - } - return o.ChangeEntity -} - -func (o *PostV1ChangesResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/postv1changeschangeididentities.go b/internal/sdk/models/operations/postv1changeschangeididentities.go deleted file mode 100644 index 2bdbc67..0000000 --- a/internal/sdk/models/operations/postv1changeschangeididentities.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ChangesChangeIDIdentitiesRequest struct { - ChangeID string `pathParam:"style=simple,explode=false,name=change_id"` - PostV1ChangesChangeIDIdentities shared.PostV1ChangesChangeIDIdentities `request:"mediaType=application/json"` -} - -func (o *PostV1ChangesChangeIDIdentitiesRequest) GetChangeID() string { - if o == nil { - return "" - } - return o.ChangeID -} - -func (o *PostV1ChangesChangeIDIdentitiesRequest) GetPostV1ChangesChangeIDIdentities() shared.PostV1ChangesChangeIDIdentities { - if o == nil { - return shared.PostV1ChangesChangeIDIdentities{} - } - return o.PostV1ChangesChangeIDIdentities -} - -type PostV1ChangesChangeIDIdentitiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create an identity for this change - ChangeIdentityEntity *shared.ChangeIdentityEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PostV1ChangesChangeIDIdentitiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ChangesChangeIDIdentitiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ChangesChangeIDIdentitiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1ChangesChangeIDIdentitiesResponse) GetChangeIdentityEntity() *shared.ChangeIdentityEntity { - if o == nil { - return nil - } - return o.ChangeIdentityEntity -} - -func (o *PostV1ChangesChangeIDIdentitiesResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/postv1changesevents.go b/internal/sdk/models/operations/postv1changesevents.go deleted file mode 100644 index ff33f37..0000000 --- a/internal/sdk/models/operations/postv1changesevents.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ChangesEventsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a change event - ChangeEventEntity *shared.ChangeEventEntity -} - -func (o *PostV1ChangesEventsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ChangesEventsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ChangesEventsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1ChangesEventsResponse) GetChangeEventEntity() *shared.ChangeEventEntity { - if o == nil { - return nil - } - return o.ChangeEventEntity -} diff --git a/internal/sdk/models/operations/postv1checklisttemplates.go b/internal/sdk/models/operations/postv1checklisttemplates.go deleted file mode 100644 index 5aae514..0000000 --- a/internal/sdk/models/operations/postv1checklisttemplates.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ChecklistTemplatesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates a checklist template for the organization - ChecklistTemplateEntity *shared.ChecklistTemplateEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PostV1ChecklistTemplatesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ChecklistTemplatesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ChecklistTemplatesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1ChecklistTemplatesResponse) GetChecklistTemplateEntity() *shared.ChecklistTemplateEntity { - if o == nil { - return nil - } - return o.ChecklistTemplateEntity -} - -func (o *PostV1ChecklistTemplatesResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/postv1conversationsconversationidcomments.go b/internal/sdk/models/operations/postv1conversationsconversationidcomments.go deleted file mode 100644 index 1183c7f..0000000 --- a/internal/sdk/models/operations/postv1conversationsconversationidcomments.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ConversationsConversationIDCommentsRequest struct { - ConversationID string `pathParam:"style=simple,explode=false,name=conversation_id"` - PostV1ConversationsConversationIDComments shared.PostV1ConversationsConversationIDComments `request:"mediaType=application/json"` -} - -func (o *PostV1ConversationsConversationIDCommentsRequest) GetConversationID() string { - if o == nil { - return "" - } - return o.ConversationID -} - -func (o *PostV1ConversationsConversationIDCommentsRequest) GetPostV1ConversationsConversationIDComments() shared.PostV1ConversationsConversationIDComments { - if o == nil { - return shared.PostV1ConversationsConversationIDComments{} - } - return o.PostV1ConversationsConversationIDComments -} - -type PostV1ConversationsConversationIDCommentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1ConversationsConversationIDCommentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ConversationsConversationIDCommentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ConversationsConversationIDCommentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1conversationsconversationidcommentscommentidreactions.go b/internal/sdk/models/operations/postv1conversationsconversationidcommentscommentidreactions.go deleted file mode 100644 index e534b03..0000000 --- a/internal/sdk/models/operations/postv1conversationsconversationidcommentscommentidreactions.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ConversationsConversationIDCommentsCommentIDReactionsRequest struct { - ConversationID string `pathParam:"style=simple,explode=false,name=conversation_id"` - CommentID string `pathParam:"style=simple,explode=false,name=comment_id"` - PostV1ConversationsConversationIDCommentsCommentIDReactions shared.PostV1ConversationsConversationIDCommentsCommentIDReactions `request:"mediaType=application/json"` -} - -func (o *PostV1ConversationsConversationIDCommentsCommentIDReactionsRequest) GetConversationID() string { - if o == nil { - return "" - } - return o.ConversationID -} - -func (o *PostV1ConversationsConversationIDCommentsCommentIDReactionsRequest) GetCommentID() string { - if o == nil { - return "" - } - return o.CommentID -} - -func (o *PostV1ConversationsConversationIDCommentsCommentIDReactionsRequest) GetPostV1ConversationsConversationIDCommentsCommentIDReactions() shared.PostV1ConversationsConversationIDCommentsCommentIDReactions { - if o == nil { - return shared.PostV1ConversationsConversationIDCommentsCommentIDReactions{} - } - return o.PostV1ConversationsConversationIDCommentsCommentIDReactions -} - -type PostV1ConversationsConversationIDCommentsCommentIDReactionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1ConversationsConversationIDCommentsCommentIDReactionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ConversationsConversationIDCommentsCommentIDReactionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ConversationsConversationIDCommentsCommentIDReactionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1customfieldsdefinitions.go b/internal/sdk/models/operations/postv1customfieldsdefinitions.go deleted file mode 100644 index ce6ea0b..0000000 --- a/internal/sdk/models/operations/postv1customfieldsdefinitions.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1CustomFieldsDefinitionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new custom field definition - OrganizationsCustomFieldDefinitionEntity *shared.OrganizationsCustomFieldDefinitionEntity -} - -func (o *PostV1CustomFieldsDefinitionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1CustomFieldsDefinitionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1CustomFieldsDefinitionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1CustomFieldsDefinitionsResponse) GetOrganizationsCustomFieldDefinitionEntity() *shared.OrganizationsCustomFieldDefinitionEntity { - if o == nil { - return nil - } - return o.OrganizationsCustomFieldDefinitionEntity -} diff --git a/internal/sdk/models/operations/postv1environments.go b/internal/sdk/models/operations/postv1environments.go deleted file mode 100644 index 4295283..0000000 --- a/internal/sdk/models/operations/postv1environments.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1EnvironmentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates an environment for the organization - EnvironmentEntryEntity *shared.EnvironmentEntryEntity -} - -func (o *PostV1EnvironmentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1EnvironmentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1EnvironmentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1EnvironmentsResponse) GetEnvironmentEntryEntity() *shared.EnvironmentEntryEntity { - if o == nil { - return nil - } - return o.EnvironmentEntryEntity -} diff --git a/internal/sdk/models/operations/postv1functionalities.go b/internal/sdk/models/operations/postv1functionalities.go deleted file mode 100644 index 430f24d..0000000 --- a/internal/sdk/models/operations/postv1functionalities.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1FunctionalitiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates a functionality for the organization - FunctionalityEntity *shared.FunctionalityEntity -} - -func (o *PostV1FunctionalitiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1FunctionalitiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1FunctionalitiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1FunctionalitiesResponse) GetFunctionalityEntity() *shared.FunctionalityEntity { - if o == nil { - return nil - } - return o.FunctionalityEntity -} diff --git a/internal/sdk/models/operations/postv1incidentroles.go b/internal/sdk/models/operations/postv1incidentroles.go deleted file mode 100644 index a085e21..0000000 --- a/internal/sdk/models/operations/postv1incidentroles.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentRolesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new incident role - IncidentRoleEntity *shared.IncidentRoleEntity -} - -func (o *PostV1IncidentRolesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentRolesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentRolesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentRolesResponse) GetIncidentRoleEntity() *shared.IncidentRoleEntity { - if o == nil { - return nil - } - return o.IncidentRoleEntity -} diff --git a/internal/sdk/models/operations/postv1incidents.go b/internal/sdk/models/operations/postv1incidents.go deleted file mode 100644 index c0d6f28..0000000 --- a/internal/sdk/models/operations/postv1incidents.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new incident - IncidentEntity *shared.IncidentEntity -} - -func (o *PostV1IncidentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidalerts.go b/internal/sdk/models/operations/postv1incidentsincidentidalerts.go deleted file mode 100644 index da95fe5..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidalerts.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PostV1IncidentsIncidentIDAlertsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - // Array of alert IDs to be assigned to the incident - RequestBody []string `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDAlertsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDAlertsRequest) GetRequestBody() []string { - if o == nil { - return []string{} - } - return o.RequestBody -} - -type PostV1IncidentsIncidentIDAlertsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1IncidentsIncidentIDAlertsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDAlertsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDAlertsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidattachments.go b/internal/sdk/models/operations/postv1incidentsincidentidattachments.go deleted file mode 100644 index 8ce98cc..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidattachments.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "time" -) - -type File struct { - FileName string `multipartForm:"name=file"` - Content []byte `multipartForm:"content"` -} - -func (o *File) GetFileName() string { - if o == nil { - return "" - } - return o.FileName -} - -func (o *File) GetContent() []byte { - if o == nil { - return []byte{} - } - return o.Content -} - -type VoteDirection string - -const ( - VoteDirectionUp VoteDirection = "up" - VoteDirectionDown VoteDirection = "down" -) - -func (e VoteDirection) ToPointer() *VoteDirection { - return &e -} -func (e *VoteDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "up": - fallthrough - case "down": - *e = VoteDirection(v) - return nil - default: - return fmt.Errorf("invalid value for VoteDirection: %v", v) - } -} - -type PostV1IncidentsIncidentIDAttachmentsRequestBody struct { - File File `multipartForm:"file"` - Description *string `multipartForm:"name=description"` - OccurredAt *time.Time `multipartForm:"name=occurred_at"` - VoteDirection *VoteDirection `multipartForm:"name=vote_direction"` -} - -func (p PostV1IncidentsIncidentIDAttachmentsRequestBody) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PostV1IncidentsIncidentIDAttachmentsRequestBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PostV1IncidentsIncidentIDAttachmentsRequestBody) GetFile() File { - if o == nil { - return File{} - } - return o.File -} - -func (o *PostV1IncidentsIncidentIDAttachmentsRequestBody) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1IncidentsIncidentIDAttachmentsRequestBody) GetOccurredAt() *time.Time { - if o == nil { - return nil - } - return o.OccurredAt -} - -func (o *PostV1IncidentsIncidentIDAttachmentsRequestBody) GetVoteDirection() *VoteDirection { - if o == nil { - return nil - } - return o.VoteDirection -} - -type PostV1IncidentsIncidentIDAttachmentsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - RequestBody PostV1IncidentsIncidentIDAttachmentsRequestBody `request:"mediaType=multipart/form-data"` -} - -func (o *PostV1IncidentsIncidentIDAttachmentsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDAttachmentsRequest) GetRequestBody() PostV1IncidentsIncidentIDAttachmentsRequestBody { - if o == nil { - return PostV1IncidentsIncidentIDAttachmentsRequestBody{} - } - return o.RequestBody -} - -type PostV1IncidentsIncidentIDAttachmentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Allows adding image attachments to an incident - IncidentAttachmentEntity *shared.IncidentAttachmentEntity -} - -func (o *PostV1IncidentsIncidentIDAttachmentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDAttachmentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDAttachmentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDAttachmentsResponse) GetIncidentAttachmentEntity() *shared.IncidentAttachmentEntity { - if o == nil { - return nil - } - return o.IncidentAttachmentEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidgenericchatmessages.go b/internal/sdk/models/operations/postv1incidentsincidentidgenericchatmessages.go deleted file mode 100644 index 8d8f578..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidgenericchatmessages.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDGenericChatMessagesRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDGenericChatMessages shared.PostV1IncidentsIncidentIDGenericChatMessages `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessagesRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessagesRequest) GetPostV1IncidentsIncidentIDGenericChatMessages() shared.PostV1IncidentsIncidentIDGenericChatMessages { - if o == nil { - return shared.PostV1IncidentsIncidentIDGenericChatMessages{} - } - return o.PostV1IncidentsIncidentIDGenericChatMessages -} - -type PostV1IncidentsIncidentIDGenericChatMessagesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new generic chat message on an incident timeline. These are independent of any specific chat provider. - EventGenericChatMessageEntity *shared.EventGenericChatMessageEntity -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessagesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessagesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessagesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessagesResponse) GetEventGenericChatMessageEntity() *shared.EventGenericChatMessageEntity { - if o == nil { - return nil - } - return o.EventGenericChatMessageEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidimpacttype.go b/internal/sdk/models/operations/postv1incidentsincidentidimpacttype.go deleted file mode 100644 index ab22bf7..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidimpacttype.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PathParamType string - -const ( - PathParamTypeEnvironments PathParamType = "environments" - PathParamTypeFunctionalities PathParamType = "functionalities" - PathParamTypeServices PathParamType = "services" - PathParamTypeCustomers PathParamType = "customers" -) - -func (e PathParamType) ToPointer() *PathParamType { - return &e -} -func (e *PathParamType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "environments": - fallthrough - case "functionalities": - fallthrough - case "services": - fallthrough - case "customers": - *e = PathParamType(v) - return nil - default: - return fmt.Errorf("invalid value for PathParamType: %v", v) - } -} - -type PostV1IncidentsIncidentIDImpactTypeRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - Type PathParamType `pathParam:"style=simple,explode=false,name=type"` - PostV1IncidentsIncidentIDImpactType shared.PostV1IncidentsIncidentIDImpactType `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDImpactTypeRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDImpactTypeRequest) GetType() PathParamType { - if o == nil { - return PathParamType("") - } - return o.Type -} - -func (o *PostV1IncidentsIncidentIDImpactTypeRequest) GetPostV1IncidentsIncidentIDImpactType() shared.PostV1IncidentsIncidentIDImpactType { - if o == nil { - return shared.PostV1IncidentsIncidentIDImpactType{} - } - return o.PostV1IncidentsIncidentIDImpactType -} - -type PostV1IncidentsIncidentIDImpactTypeResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Add impacted infrastructure to an incident - IncidentImpactEntity *shared.IncidentImpactEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PostV1IncidentsIncidentIDImpactTypeResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDImpactTypeResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDImpactTypeResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDImpactTypeResponse) GetIncidentImpactEntity() *shared.IncidentImpactEntity { - if o == nil { - return nil - } - return o.IncidentImpactEntity -} - -func (o *PostV1IncidentsIncidentIDImpactTypeResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidlinks.go b/internal/sdk/models/operations/postv1incidentsincidentidlinks.go deleted file mode 100644 index d78f0d0..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidlinks.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDLinksRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDLinks shared.PostV1IncidentsIncidentIDLinks `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDLinksRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDLinksRequest) GetPostV1IncidentsIncidentIDLinks() shared.PostV1IncidentsIncidentIDLinks { - if o == nil { - return shared.PostV1IncidentsIncidentIDLinks{} - } - return o.PostV1IncidentsIncidentIDLinks -} - -type PostV1IncidentsIncidentIDLinksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Allows adding adhoc links to an incident as an attachment - AttachmentsLinkEntity *shared.AttachmentsLinkEntity -} - -func (o *PostV1IncidentsIncidentIDLinksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDLinksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDLinksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDLinksResponse) GetAttachmentsLinkEntity() *shared.AttachmentsLinkEntity { - if o == nil { - return nil - } - return o.AttachmentsLinkEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidnotes.go b/internal/sdk/models/operations/postv1incidentsincidentidnotes.go deleted file mode 100644 index d1fceba..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidnotes.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDNotesRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDNotes shared.PostV1IncidentsIncidentIDNotes `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDNotesRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDNotesRequest) GetPostV1IncidentsIncidentIDNotes() shared.PostV1IncidentsIncidentIDNotes { - if o == nil { - return shared.PostV1IncidentsIncidentIDNotes{} - } - return o.PostV1IncidentsIncidentIDNotes -} - -type PostV1IncidentsIncidentIDNotesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new note on for an incident. The visibility field on a note determines where it gets posted. - EventNoteEntity *shared.EventNoteEntity -} - -func (o *PostV1IncidentsIncidentIDNotesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDNotesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDNotesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDNotesResponse) GetEventNoteEntity() *shared.EventNoteEntity { - if o == nil { - return nil - } - return o.EventNoteEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidrelatedchangeevents.go b/internal/sdk/models/operations/postv1incidentsincidentidrelatedchangeevents.go deleted file mode 100644 index d7c8a08..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidrelatedchangeevents.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDRelatedChangeEventsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDRelatedChangeEvents shared.PostV1IncidentsIncidentIDRelatedChangeEvents `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEventsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEventsRequest) GetPostV1IncidentsIncidentIDRelatedChangeEvents() shared.PostV1IncidentsIncidentIDRelatedChangeEvents { - if o == nil { - return shared.PostV1IncidentsIncidentIDRelatedChangeEvents{} - } - return o.PostV1IncidentsIncidentIDRelatedChangeEvents -} - -type PostV1IncidentsIncidentIDRelatedChangeEventsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Add a related change to an incident. Changes added to an incident can be causes, fixes, or suspects. To remove a change from an incident, the type field should be set to dismissed. - IncidentsRelatedChangeEventEntity *shared.IncidentsRelatedChangeEventEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEventsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEventsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEventsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEventsResponse) GetIncidentsRelatedChangeEventEntity() *shared.IncidentsRelatedChangeEventEntity { - if o == nil { - return nil - } - return o.IncidentsRelatedChangeEventEntity -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEventsResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidroleassignments.go b/internal/sdk/models/operations/postv1incidentsincidentidroleassignments.go deleted file mode 100644 index 7d6e11c..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidroleassignments.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDRoleAssignmentsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDRoleAssignments shared.PostV1IncidentsIncidentIDRoleAssignments `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDRoleAssignmentsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDRoleAssignmentsRequest) GetPostV1IncidentsIncidentIDRoleAssignments() shared.PostV1IncidentsIncidentIDRoleAssignments { - if o == nil { - return shared.PostV1IncidentsIncidentIDRoleAssignments{} - } - return o.PostV1IncidentsIncidentIDRoleAssignments -} - -type PostV1IncidentsIncidentIDRoleAssignmentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Assign a role to a user for this incident - IncidentsRoleAssignmentEntity *shared.IncidentsRoleAssignmentEntity -} - -func (o *PostV1IncidentsIncidentIDRoleAssignmentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDRoleAssignmentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDRoleAssignmentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDRoleAssignmentsResponse) GetIncidentsRoleAssignmentEntity() *shared.IncidentsRoleAssignmentEntity { - if o == nil { - return nil - } - return o.IncidentsRoleAssignmentEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidstatuspages.go b/internal/sdk/models/operations/postv1incidentsincidentidstatuspages.go deleted file mode 100644 index 7b4f169..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidstatuspages.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDStatusPagesRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDStatusPages shared.PostV1IncidentsIncidentIDStatusPages `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDStatusPagesRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDStatusPagesRequest) GetPostV1IncidentsIncidentIDStatusPages() shared.PostV1IncidentsIncidentIDStatusPages { - if o == nil { - return shared.PostV1IncidentsIncidentIDStatusPages{} - } - return o.PostV1IncidentsIncidentIDStatusPages -} - -type PostV1IncidentsIncidentIDStatusPagesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Add a status page to an incident. - IncidentsStatusPageEntity *shared.IncidentsStatusPageEntity -} - -func (o *PostV1IncidentsIncidentIDStatusPagesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDStatusPagesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDStatusPagesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDStatusPagesResponse) GetIncidentsStatusPageEntity() *shared.IncidentsStatusPageEntity { - if o == nil { - return nil - } - return o.IncidentsStatusPageEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidtasklists.go b/internal/sdk/models/operations/postv1incidentsincidentidtasklists.go deleted file mode 100644 index 6beb331..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidtasklists.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDTaskListsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDTaskLists shared.PostV1IncidentsIncidentIDTaskLists `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDTaskListsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDTaskListsRequest) GetPostV1IncidentsIncidentIDTaskLists() shared.PostV1IncidentsIncidentIDTaskLists { - if o == nil { - return shared.PostV1IncidentsIncidentIDTaskLists{} - } - return o.PostV1IncidentsIncidentIDTaskLists -} - -type PostV1IncidentsIncidentIDTaskListsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Add all tasks from list to incident - TaskEntity *shared.TaskEntity -} - -func (o *PostV1IncidentsIncidentIDTaskListsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDTaskListsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDTaskListsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDTaskListsResponse) GetTaskEntity() *shared.TaskEntity { - if o == nil { - return nil - } - return o.TaskEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidtasks.go b/internal/sdk/models/operations/postv1incidentsincidentidtasks.go deleted file mode 100644 index 22ad3a0..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidtasks.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDTasksRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDTasks shared.PostV1IncidentsIncidentIDTasks `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDTasksRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDTasksRequest) GetPostV1IncidentsIncidentIDTasks() shared.PostV1IncidentsIncidentIDTasks { - if o == nil { - return shared.PostV1IncidentsIncidentIDTasks{} - } - return o.PostV1IncidentsIncidentIDTasks -} - -type PostV1IncidentsIncidentIDTasksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a task - TaskEntity *shared.TaskEntity -} - -func (o *PostV1IncidentsIncidentIDTasksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDTasksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDTasksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDTasksResponse) GetTaskEntity() *shared.TaskEntity { - if o == nil { - return nil - } - return o.TaskEntity -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidtaskstaskidconvert.go b/internal/sdk/models/operations/postv1incidentsincidentidtaskstaskidconvert.go deleted file mode 100644 index d419282..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidtaskstaskidconvert.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDTasksTaskIDConvertRequest struct { - TaskID string `pathParam:"style=simple,explode=false,name=task_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDTasksTaskIDConvert shared.PostV1IncidentsIncidentIDTasksTaskIDConvert `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvertRequest) GetTaskID() string { - if o == nil { - return "" - } - return o.TaskID -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvertRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvertRequest) GetPostV1IncidentsIncidentIDTasksTaskIDConvert() shared.PostV1IncidentsIncidentIDTasksTaskIDConvert { - if o == nil { - return shared.PostV1IncidentsIncidentIDTasksTaskIDConvert{} - } - return o.PostV1IncidentsIncidentIDTasksTaskIDConvert -} - -type PostV1IncidentsIncidentIDTasksTaskIDConvertResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Convert a task to a follow-up - TaskEntityPaginated *shared.TaskEntityPaginated -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvertResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvertResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvertResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvertResponse) GetTaskEntityPaginated() *shared.TaskEntityPaginated { - if o == nil { - return nil - } - return o.TaskEntityPaginated -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidteamassignments.go b/internal/sdk/models/operations/postv1incidentsincidentidteamassignments.go deleted file mode 100644 index 452743d..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidteamassignments.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDTeamAssignmentsRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PostV1IncidentsIncidentIDTeamAssignments shared.PostV1IncidentsIncidentIDTeamAssignments `request:"mediaType=application/json"` -} - -func (o *PostV1IncidentsIncidentIDTeamAssignmentsRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PostV1IncidentsIncidentIDTeamAssignmentsRequest) GetPostV1IncidentsIncidentIDTeamAssignments() shared.PostV1IncidentsIncidentIDTeamAssignments { - if o == nil { - return shared.PostV1IncidentsIncidentIDTeamAssignments{} - } - return o.PostV1IncidentsIncidentIDTeamAssignments -} - -type PostV1IncidentsIncidentIDTeamAssignmentsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1IncidentsIncidentIDTeamAssignmentsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDTeamAssignmentsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDTeamAssignmentsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1incidentsincidentidunarchive.go b/internal/sdk/models/operations/postv1incidentsincidentidunarchive.go deleted file mode 100644 index 72e4cef..0000000 --- a/internal/sdk/models/operations/postv1incidentsincidentidunarchive.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentsIncidentIDUnarchiveRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *PostV1IncidentsIncidentIDUnarchiveRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type PostV1IncidentsIncidentIDUnarchiveResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Unarchives an incident - IncidentEntity *shared.IncidentEntity -} - -func (o *PostV1IncidentsIncidentIDUnarchiveResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentsIncidentIDUnarchiveResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentsIncidentIDUnarchiveResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentsIncidentIDUnarchiveResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/postv1incidenttagsvalidate.go b/internal/sdk/models/operations/postv1incidenttagsvalidate.go deleted file mode 100644 index fd0f65b..0000000 --- a/internal/sdk/models/operations/postv1incidenttagsvalidate.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentTagsValidateResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Validate the format of a list of tags - TagEntity *shared.TagEntity -} - -func (o *PostV1IncidentTagsValidateResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentTagsValidateResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentTagsValidateResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentTagsValidateResponse) GetTagEntity() *shared.TagEntity { - if o == nil { - return nil - } - return o.TagEntity -} diff --git a/internal/sdk/models/operations/postv1incidenttypes.go b/internal/sdk/models/operations/postv1incidenttypes.go deleted file mode 100644 index a75c6ac..0000000 --- a/internal/sdk/models/operations/postv1incidenttypes.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1IncidentTypesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new incident type - IncidentTypeEntity *shared.IncidentTypeEntity -} - -func (o *PostV1IncidentTypesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IncidentTypesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IncidentTypesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1IncidentTypesResponse) GetIncidentTypeEntity() *shared.IncidentTypeEntity { - if o == nil { - return nil - } - return o.IncidentTypeEntity -} diff --git a/internal/sdk/models/operations/postv1integrationsconnectionsslug.go b/internal/sdk/models/operations/postv1integrationsconnectionsslug.go deleted file mode 100644 index d0dee57..0000000 --- a/internal/sdk/models/operations/postv1integrationsconnectionsslug.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PostV1IntegrationsConnectionsSlugRequest struct { - Slug string `pathParam:"style=simple,explode=false,name=slug"` -} - -func (o *PostV1IntegrationsConnectionsSlugRequest) GetSlug() string { - if o == nil { - return "" - } - return o.Slug -} - -type PostV1IntegrationsConnectionsSlugResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1IntegrationsConnectionsSlugResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IntegrationsConnectionsSlugResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IntegrationsConnectionsSlugResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1integrationsslackconnectionsconnectionidemojiactions.go b/internal/sdk/models/operations/postv1integrationsslackconnectionsconnectionidemojiactions.go deleted file mode 100644 index 57c19b8..0000000 --- a/internal/sdk/models/operations/postv1integrationsslackconnectionsconnectionidemojiactions.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequestBody struct { - // The name of the emoji to associate with this action - EmojiName string `form:"name=emoji_name"` - // The ID of the incident type to associate with this emoji action - IncidentTypeID *string `form:"name=incident_type_id"` -} - -func (o *PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequestBody) GetEmojiName() string { - if o == nil { - return "" - } - return o.EmojiName -} - -func (o *PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequestBody) GetIncidentTypeID() *string { - if o == nil { - return nil - } - return o.IncidentTypeID -} - -type PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest struct { - // Slack Connection UUID - ConnectionID string `pathParam:"style=simple,explode=false,name=connection_id"` - RequestBody PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -func (o *PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequest) GetRequestBody() PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequestBody { - if o == nil { - return PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsRequestBody{} - } - return o.RequestBody -} - -type PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1IntegrationsSlackConnectionsConnectionIDEmojiActionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1lifecyclesmeasurementdefinitions.go b/internal/sdk/models/operations/postv1lifecyclesmeasurementdefinitions.go deleted file mode 100644 index be7537b..0000000 --- a/internal/sdk/models/operations/postv1lifecyclesmeasurementdefinitions.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PostV1LifecyclesMeasurementDefinitionsRequestBody struct { - Name string `form:"name=name"` - Slug *string `form:"name=slug"` - Description *string `form:"name=description"` - StartsAtMilestoneID string `form:"name=starts_at_milestone_id"` - EndsAtMilestoneID string `form:"name=ends_at_milestone_id"` -} - -func (o *PostV1LifecyclesMeasurementDefinitionsRequestBody) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1LifecyclesMeasurementDefinitionsRequestBody) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PostV1LifecyclesMeasurementDefinitionsRequestBody) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1LifecyclesMeasurementDefinitionsRequestBody) GetStartsAtMilestoneID() string { - if o == nil { - return "" - } - return o.StartsAtMilestoneID -} - -func (o *PostV1LifecyclesMeasurementDefinitionsRequestBody) GetEndsAtMilestoneID() string { - if o == nil { - return "" - } - return o.EndsAtMilestoneID -} - -type PostV1LifecyclesMeasurementDefinitionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1LifecyclesMeasurementDefinitionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1LifecyclesMeasurementDefinitionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1LifecyclesMeasurementDefinitionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1lifecyclesmilestones.go b/internal/sdk/models/operations/postv1lifecyclesmilestones.go deleted file mode 100644 index c349c6e..0000000 --- a/internal/sdk/models/operations/postv1lifecyclesmilestones.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1LifecyclesMilestonesRequestBody struct { - // The name of the milestone - Name string `form:"name=name"` - // A long-form description of the milestone's purpose - Description string `form:"name=description"` - // A unique identifier for the milestone. If not provided, one will be generated from the name. - Slug *string `form:"name=slug"` - // The ID of the phase to which the milestone should belong - PhaseID string `form:"name=phase_id"` - // The position of the milestone within the phase. If not provided, the milestone will be added as the last milestone in the phase. - Position *int `form:"name=position"` - // The ID of a later milestone that cannot be started until this milestone has a timestamp populated - RequiredAtMilestoneID *string `form:"name=required_at_milestone_id"` -} - -func (o *PostV1LifecyclesMilestonesRequestBody) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1LifecyclesMilestonesRequestBody) GetDescription() string { - if o == nil { - return "" - } - return o.Description -} - -func (o *PostV1LifecyclesMilestonesRequestBody) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PostV1LifecyclesMilestonesRequestBody) GetPhaseID() string { - if o == nil { - return "" - } - return o.PhaseID -} - -func (o *PostV1LifecyclesMilestonesRequestBody) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *PostV1LifecyclesMilestonesRequestBody) GetRequiredAtMilestoneID() *string { - if o == nil { - return nil - } - return o.RequiredAtMilestoneID -} - -type PostV1LifecyclesMilestonesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new milestone - LifecyclesPhaseEntityList *shared.LifecyclesPhaseEntityList -} - -func (o *PostV1LifecyclesMilestonesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1LifecyclesMilestonesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1LifecyclesMilestonesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1LifecyclesMilestonesResponse) GetLifecyclesPhaseEntityList() *shared.LifecyclesPhaseEntityList { - if o == nil { - return nil - } - return o.LifecyclesPhaseEntityList -} diff --git a/internal/sdk/models/operations/postv1nuncconnections.go b/internal/sdk/models/operations/postv1nuncconnections.go deleted file mode 100644 index 616da10..0000000 --- a/internal/sdk/models/operations/postv1nuncconnections.go +++ /dev/null @@ -1,188 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1NuncConnectionsRequestBody struct { - Domain string `form:"name=domain"` - CompanyName *string `form:"name=company_name"` - CompanyWebsite *string `form:"name=company_website"` - CompanyTosURL *string `form:"name=company_tos_url"` - GreetingTitle *string `form:"name=greeting_title"` - GreetingBody *string `form:"name=greeting_body"` - OperationalMessage *string `form:"name=operational_message"` - Title *string `form:"name=title"` - // Status page condition to map your severity matrix condition to - ConditionsNuncCondition []string `form:"name=conditions[nunc_condition]"` - // Severity matrix condition id - ConditionsConditionID []string `form:"name=conditions[condition_id]"` - ComponentsInfrastructureType []string `form:"name=components[infrastructure_type]"` - ComponentsInfrastructureID []string `form:"name=components[infrastructure_id]"` - PrimaryColor *string `form:"name=primary_color"` - SecondaryColor *string `form:"name=secondary_color"` - ExposedFields []string `form:"name=exposed_fields"` - EnableHistogram *bool `form:"name=enable_histogram"` - UIVersion *int `form:"name=ui_version"` -} - -func (o *PostV1NuncConnectionsRequestBody) GetDomain() string { - if o == nil { - return "" - } - return o.Domain -} - -func (o *PostV1NuncConnectionsRequestBody) GetCompanyName() *string { - if o == nil { - return nil - } - return o.CompanyName -} - -func (o *PostV1NuncConnectionsRequestBody) GetCompanyWebsite() *string { - if o == nil { - return nil - } - return o.CompanyWebsite -} - -func (o *PostV1NuncConnectionsRequestBody) GetCompanyTosURL() *string { - if o == nil { - return nil - } - return o.CompanyTosURL -} - -func (o *PostV1NuncConnectionsRequestBody) GetGreetingTitle() *string { - if o == nil { - return nil - } - return o.GreetingTitle -} - -func (o *PostV1NuncConnectionsRequestBody) GetGreetingBody() *string { - if o == nil { - return nil - } - return o.GreetingBody -} - -func (o *PostV1NuncConnectionsRequestBody) GetOperationalMessage() *string { - if o == nil { - return nil - } - return o.OperationalMessage -} - -func (o *PostV1NuncConnectionsRequestBody) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *PostV1NuncConnectionsRequestBody) GetConditionsNuncCondition() []string { - if o == nil { - return []string{} - } - return o.ConditionsNuncCondition -} - -func (o *PostV1NuncConnectionsRequestBody) GetConditionsConditionID() []string { - if o == nil { - return []string{} - } - return o.ConditionsConditionID -} - -func (o *PostV1NuncConnectionsRequestBody) GetComponentsInfrastructureType() []string { - if o == nil { - return []string{} - } - return o.ComponentsInfrastructureType -} - -func (o *PostV1NuncConnectionsRequestBody) GetComponentsInfrastructureID() []string { - if o == nil { - return []string{} - } - return o.ComponentsInfrastructureID -} - -func (o *PostV1NuncConnectionsRequestBody) GetPrimaryColor() *string { - if o == nil { - return nil - } - return o.PrimaryColor -} - -func (o *PostV1NuncConnectionsRequestBody) GetSecondaryColor() *string { - if o == nil { - return nil - } - return o.SecondaryColor -} - -func (o *PostV1NuncConnectionsRequestBody) GetExposedFields() []string { - if o == nil { - return nil - } - return o.ExposedFields -} - -func (o *PostV1NuncConnectionsRequestBody) GetEnableHistogram() *bool { - if o == nil { - return nil - } - return o.EnableHistogram -} - -func (o *PostV1NuncConnectionsRequestBody) GetUIVersion() *int { - if o == nil { - return nil - } - return o.UIVersion -} - -type PostV1NuncConnectionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new FireHydrant hosted status page for customer facing statuses. - NuncConnectionEntity *shared.NuncConnectionEntity -} - -func (o *PostV1NuncConnectionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1NuncConnectionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1NuncConnectionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1NuncConnectionsResponse) GetNuncConnectionEntity() *shared.NuncConnectionEntity { - if o == nil { - return nil - } - return o.NuncConnectionEntity -} diff --git a/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidcomponentgroups.go b/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidcomponentgroups.go deleted file mode 100644 index 2ab1dcd..0000000 --- a/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidcomponentgroups.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequestBody struct { - Name string `form:"name=name"` - ComponentGroupID *string `form:"name=component_group_id"` - Position *int `form:"name=position"` -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequestBody) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequestBody) GetComponentGroupID() *string { - if o == nil { - return nil - } - return o.ComponentGroupID -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequestBody) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -type PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - RequestBody PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequest) GetRequestBody() PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequestBody { - if o == nil { - return PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequestBody{} - } - return o.RequestBody -} - -type PostV1NuncConnectionsNuncConnectionIDComponentGroupsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Add a component group to be displayed on a FireHydrant status page - NuncConnectionEntity *shared.NuncConnectionEntity -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1NuncConnectionsNuncConnectionIDComponentGroupsResponse) GetNuncConnectionEntity() *shared.NuncConnectionEntity { - if o == nil { - return nil - } - return o.NuncConnectionEntity -} diff --git a/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidlinks.go b/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidlinks.go deleted file mode 100644 index 03ccb64..0000000 --- a/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidlinks.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1NuncConnectionsNuncConnectionIDLinksRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` -} - -func (o *PostV1NuncConnectionsNuncConnectionIDLinksRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -type PostV1NuncConnectionsNuncConnectionIDLinksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Add a link to be displayed on a FireHydrant status page - NuncConnectionEntity *shared.NuncConnectionEntity -} - -func (o *PostV1NuncConnectionsNuncConnectionIDLinksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1NuncConnectionsNuncConnectionIDLinksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1NuncConnectionsNuncConnectionIDLinksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1NuncConnectionsNuncConnectionIDLinksResponse) GetNuncConnectionEntity() *shared.NuncConnectionEntity { - if o == nil { - return nil - } - return o.NuncConnectionEntity -} diff --git a/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidsubscribers.go b/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidsubscribers.go deleted file mode 100644 index e7dc272..0000000 --- a/internal/sdk/models/operations/postv1nuncconnectionsnuncconnectionidsubscribers.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1NuncConnectionsNuncConnectionIDSubscribersRequestBody struct { - // A comma-separated list of emails to subscribe. - Emails string `form:"name=emails"` -} - -func (o *PostV1NuncConnectionsNuncConnectionIDSubscribersRequestBody) GetEmails() string { - if o == nil { - return "" - } - return o.Emails -} - -type PostV1NuncConnectionsNuncConnectionIDSubscribersRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - RequestBody PostV1NuncConnectionsNuncConnectionIDSubscribersRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PostV1NuncConnectionsNuncConnectionIDSubscribersRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *PostV1NuncConnectionsNuncConnectionIDSubscribersRequest) GetRequestBody() PostV1NuncConnectionsNuncConnectionIDSubscribersRequestBody { - if o == nil { - return PostV1NuncConnectionsNuncConnectionIDSubscribersRequestBody{} - } - return o.RequestBody -} - -type PostV1NuncConnectionsNuncConnectionIDSubscribersResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Subscribes a comma-separated string of emails to status page updates - NuncEmailSubscribersEntity *shared.NuncEmailSubscribersEntity -} - -func (o *PostV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1NuncConnectionsNuncConnectionIDSubscribersResponse) GetNuncEmailSubscribersEntity() *shared.NuncEmailSubscribersEntity { - if o == nil { - return nil - } - return o.NuncEmailSubscribersEntity -} diff --git a/internal/sdk/models/operations/postv1nuncsubscriptions.go b/internal/sdk/models/operations/postv1nuncsubscriptions.go deleted file mode 100644 index 24125a0..0000000 --- a/internal/sdk/models/operations/postv1nuncsubscriptions.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1NuncSubscriptionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Subscribe to status page updates - NuncNuncSubscription *shared.NuncNuncSubscription -} - -func (o *PostV1NuncSubscriptionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1NuncSubscriptionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1NuncSubscriptionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1NuncSubscriptionsResponse) GetNuncNuncSubscription() *shared.NuncNuncSubscription { - if o == nil { - return nil - } - return o.NuncNuncSubscription -} diff --git a/internal/sdk/models/operations/postv1postmortemsreports.go b/internal/sdk/models/operations/postv1postmortemsreports.go deleted file mode 100644 index 2901046..0000000 --- a/internal/sdk/models/operations/postv1postmortemsreports.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1PostMortemsReportsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a report - PostMortemsPostMortemReportEntity *shared.PostMortemsPostMortemReportEntity -} - -func (o *PostV1PostMortemsReportsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1PostMortemsReportsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1PostMortemsReportsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1PostMortemsReportsResponse) GetPostMortemsPostMortemReportEntity() *shared.PostMortemsPostMortemReportEntity { - if o == nil { - return nil - } - return o.PostMortemsPostMortemReportEntity -} diff --git a/internal/sdk/models/operations/postv1postmortemsreportsreportidpublish.go b/internal/sdk/models/operations/postv1postmortemsreportsreportidpublish.go deleted file mode 100644 index 06e2988..0000000 --- a/internal/sdk/models/operations/postv1postmortemsreportsreportidpublish.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1PostMortemsReportsReportIDPublishRequest struct { - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` - PostV1PostMortemsReportsReportIDPublish shared.PostV1PostMortemsReportsReportIDPublish `request:"mediaType=application/json"` -} - -func (o *PostV1PostMortemsReportsReportIDPublishRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -func (o *PostV1PostMortemsReportsReportIDPublishRequest) GetPostV1PostMortemsReportsReportIDPublish() shared.PostV1PostMortemsReportsReportIDPublish { - if o == nil { - return shared.PostV1PostMortemsReportsReportIDPublish{} - } - return o.PostV1PostMortemsReportsReportIDPublish -} - -type PostV1PostMortemsReportsReportIDPublishResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Marks an incident retrospective as published and emails all of the participants in the report the summary - PostMortemsPostMortemReportEntity *shared.PostMortemsPostMortemReportEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PostV1PostMortemsReportsReportIDPublishResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1PostMortemsReportsReportIDPublishResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1PostMortemsReportsReportIDPublishResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1PostMortemsReportsReportIDPublishResponse) GetPostMortemsPostMortemReportEntity() *shared.PostMortemsPostMortemReportEntity { - if o == nil { - return nil - } - return o.PostMortemsPostMortemReportEntity -} - -func (o *PostV1PostMortemsReportsReportIDPublishResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/postv1postmortemsreportsreportidreasons.go b/internal/sdk/models/operations/postv1postmortemsreportsreportidreasons.go deleted file mode 100644 index fcb18af..0000000 --- a/internal/sdk/models/operations/postv1postmortemsreportsreportidreasons.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1PostMortemsReportsReportIDReasonsRequest struct { - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` - PostV1PostMortemsReportsReportIDReasons shared.PostV1PostMortemsReportsReportIDReasons `request:"mediaType=application/json"` -} - -func (o *PostV1PostMortemsReportsReportIDReasonsRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -func (o *PostV1PostMortemsReportsReportIDReasonsRequest) GetPostV1PostMortemsReportsReportIDReasons() shared.PostV1PostMortemsReportsReportIDReasons { - if o == nil { - return shared.PostV1PostMortemsReportsReportIDReasons{} - } - return o.PostV1PostMortemsReportsReportIDReasons -} - -type PostV1PostMortemsReportsReportIDReasonsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Add a new contributing factor to an incident - PostMortemsReasonEntity *shared.PostMortemsReasonEntity -} - -func (o *PostV1PostMortemsReportsReportIDReasonsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1PostMortemsReportsReportIDReasonsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1PostMortemsReportsReportIDReasonsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1PostMortemsReportsReportIDReasonsResponse) GetPostMortemsReasonEntity() *shared.PostMortemsReasonEntity { - if o == nil { - return nil - } - return o.PostMortemsReasonEntity -} diff --git a/internal/sdk/models/operations/postv1priorities.go b/internal/sdk/models/operations/postv1priorities.go deleted file mode 100644 index 5a1c88d..0000000 --- a/internal/sdk/models/operations/postv1priorities.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1PrioritiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new priority - PriorityEntity *shared.PriorityEntity -} - -func (o *PostV1PrioritiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1PrioritiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1PrioritiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1PrioritiesResponse) GetPriorityEntity() *shared.PriorityEntity { - if o == nil { - return nil - } - return o.PriorityEntity -} diff --git a/internal/sdk/models/operations/postv1runbooks.go b/internal/sdk/models/operations/postv1runbooks.go deleted file mode 100644 index 85e3036..0000000 --- a/internal/sdk/models/operations/postv1runbooks.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1RunbooksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new runbook for use with incidents. - RunbookEntity *shared.RunbookEntity -} - -func (o *PostV1RunbooksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1RunbooksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1RunbooksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1RunbooksResponse) GetRunbookEntity() *shared.RunbookEntity { - if o == nil { - return nil - } - return o.RunbookEntity -} diff --git a/internal/sdk/models/operations/postv1runbooksexecutions.go b/internal/sdk/models/operations/postv1runbooksexecutions.go deleted file mode 100644 index acefe26..0000000 --- a/internal/sdk/models/operations/postv1runbooksexecutions.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1RunbooksExecutionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Attaches a runbook to an incident and executes it - RunbooksExecutionEntity *shared.RunbooksExecutionEntity -} - -func (o *PostV1RunbooksExecutionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1RunbooksExecutionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1RunbooksExecutionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1RunbooksExecutionsResponse) GetRunbooksExecutionEntity() *shared.RunbooksExecutionEntity { - if o == nil { - return nil - } - return o.RunbooksExecutionEntity -} diff --git a/internal/sdk/models/operations/postv1savedsearchesresourcetype.go b/internal/sdk/models/operations/postv1savedsearchesresourcetype.go deleted file mode 100644 index f555eca..0000000 --- a/internal/sdk/models/operations/postv1savedsearchesresourcetype.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1SavedSearchesResourceTypePathParamResourceType string - -const ( - PostV1SavedSearchesResourceTypePathParamResourceTypeChangeEvents PostV1SavedSearchesResourceTypePathParamResourceType = "change_events" - PostV1SavedSearchesResourceTypePathParamResourceTypeIncidents PostV1SavedSearchesResourceTypePathParamResourceType = "incidents" - PostV1SavedSearchesResourceTypePathParamResourceTypeServices PostV1SavedSearchesResourceTypePathParamResourceType = "services" - PostV1SavedSearchesResourceTypePathParamResourceTypeScheduledMaintenances PostV1SavedSearchesResourceTypePathParamResourceType = "scheduled_maintenances" - PostV1SavedSearchesResourceTypePathParamResourceTypeTicketTasks PostV1SavedSearchesResourceTypePathParamResourceType = "ticket_tasks" - PostV1SavedSearchesResourceTypePathParamResourceTypeTicketFollowUps PostV1SavedSearchesResourceTypePathParamResourceType = "ticket_follow_ups" - PostV1SavedSearchesResourceTypePathParamResourceTypeAnalytics PostV1SavedSearchesResourceTypePathParamResourceType = "analytics" - PostV1SavedSearchesResourceTypePathParamResourceTypeImpactAnalytics PostV1SavedSearchesResourceTypePathParamResourceType = "impact_analytics" - PostV1SavedSearchesResourceTypePathParamResourceTypeAlerts PostV1SavedSearchesResourceTypePathParamResourceType = "alerts" - PostV1SavedSearchesResourceTypePathParamResourceTypeIncidentEvents PostV1SavedSearchesResourceTypePathParamResourceType = "incident_events" -) - -func (e PostV1SavedSearchesResourceTypePathParamResourceType) ToPointer() *PostV1SavedSearchesResourceTypePathParamResourceType { - return &e -} -func (e *PostV1SavedSearchesResourceTypePathParamResourceType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "change_events": - fallthrough - case "incidents": - fallthrough - case "services": - fallthrough - case "scheduled_maintenances": - fallthrough - case "ticket_tasks": - fallthrough - case "ticket_follow_ups": - fallthrough - case "analytics": - fallthrough - case "impact_analytics": - fallthrough - case "alerts": - fallthrough - case "incident_events": - *e = PostV1SavedSearchesResourceTypePathParamResourceType(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1SavedSearchesResourceTypePathParamResourceType: %v", v) - } -} - -type PostV1SavedSearchesResourceTypeRequest struct { - ResourceType PostV1SavedSearchesResourceTypePathParamResourceType `pathParam:"style=simple,explode=false,name=resource_type"` - PostV1SavedSearchesResourceType shared.PostV1SavedSearchesResourceType `request:"mediaType=application/json"` -} - -func (o *PostV1SavedSearchesResourceTypeRequest) GetResourceType() PostV1SavedSearchesResourceTypePathParamResourceType { - if o == nil { - return PostV1SavedSearchesResourceTypePathParamResourceType("") - } - return o.ResourceType -} - -func (o *PostV1SavedSearchesResourceTypeRequest) GetPostV1SavedSearchesResourceType() shared.PostV1SavedSearchesResourceType { - if o == nil { - return shared.PostV1SavedSearchesResourceType{} - } - return o.PostV1SavedSearchesResourceType -} - -type PostV1SavedSearchesResourceTypeResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new saved search for a particular resource type - SavedSearchEntity *shared.SavedSearchEntity -} - -func (o *PostV1SavedSearchesResourceTypeResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1SavedSearchesResourceTypeResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1SavedSearchesResourceTypeResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1SavedSearchesResourceTypeResponse) GetSavedSearchEntity() *shared.SavedSearchEntity { - if o == nil { - return nil - } - return o.SavedSearchEntity -} diff --git a/internal/sdk/models/operations/postv1scheduledmaintenances.go b/internal/sdk/models/operations/postv1scheduledmaintenances.go deleted file mode 100644 index 93fc3fc..0000000 --- a/internal/sdk/models/operations/postv1scheduledmaintenances.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ScheduledMaintenancesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new scheduled maintenance event - ScheduledMaintenanceEntity *shared.ScheduledMaintenanceEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PostV1ScheduledMaintenancesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ScheduledMaintenancesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ScheduledMaintenancesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1ScheduledMaintenancesResponse) GetScheduledMaintenanceEntity() *shared.ScheduledMaintenanceEntity { - if o == nil { - return nil - } - return o.ScheduledMaintenanceEntity -} - -func (o *PostV1ScheduledMaintenancesResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/postv1scimv2groups.go b/internal/sdk/models/operations/postv1scimv2groups.go deleted file mode 100644 index 51c21c0..0000000 --- a/internal/sdk/models/operations/postv1scimv2groups.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PostV1ScimV2GroupsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1ScimV2GroupsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ScimV2GroupsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ScimV2GroupsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1scimv2users.go b/internal/sdk/models/operations/postv1scimv2users.go deleted file mode 100644 index a63dea6..0000000 --- a/internal/sdk/models/operations/postv1scimv2users.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PostV1ScimV2UsersResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1ScimV2UsersResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ScimV2UsersResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ScimV2UsersResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1servicedependencies.go b/internal/sdk/models/operations/postv1servicedependencies.go deleted file mode 100644 index 3446f47..0000000 --- a/internal/sdk/models/operations/postv1servicedependencies.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ServiceDependenciesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates a service dependency relationship between two services - ServiceDependencyEntity *shared.ServiceDependencyEntity -} - -func (o *PostV1ServiceDependenciesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ServiceDependenciesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ServiceDependenciesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1ServiceDependenciesResponse) GetServiceDependencyEntity() *shared.ServiceDependencyEntity { - if o == nil { - return nil - } - return o.ServiceDependencyEntity -} diff --git a/internal/sdk/models/operations/postv1services.go b/internal/sdk/models/operations/postv1services.go deleted file mode 100644 index 76432ac..0000000 --- a/internal/sdk/models/operations/postv1services.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ServicesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates a service for the organization, you may also create or attach functionalities to the service on create. - ServiceEntity *shared.ServiceEntity - // Bad Request - ErrorEntity *shared.ErrorEntity -} - -func (o *PostV1ServicesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ServicesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ServicesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1ServicesResponse) GetServiceEntity() *shared.ServiceEntity { - if o == nil { - return nil - } - return o.ServiceEntity -} - -func (o *PostV1ServicesResponse) GetErrorEntity() *shared.ErrorEntity { - if o == nil { - return nil - } - return o.ErrorEntity -} diff --git a/internal/sdk/models/operations/postv1servicesserviceidchecklistresponsechecklistid.go b/internal/sdk/models/operations/postv1servicesserviceidchecklistresponsechecklistid.go deleted file mode 100644 index d8437d3..0000000 --- a/internal/sdk/models/operations/postv1servicesserviceidchecklistresponsechecklistid.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ServicesServiceIDChecklistResponseChecklistIDRequest struct { - ServiceID string `pathParam:"style=simple,explode=false,name=service_id"` - ChecklistID string `pathParam:"style=simple,explode=false,name=checklist_id"` - PostV1ServicesServiceIDChecklistResponseChecklistID shared.PostV1ServicesServiceIDChecklistResponseChecklistID `request:"mediaType=application/json"` -} - -func (o *PostV1ServicesServiceIDChecklistResponseChecklistIDRequest) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -func (o *PostV1ServicesServiceIDChecklistResponseChecklistIDRequest) GetChecklistID() string { - if o == nil { - return "" - } - return o.ChecklistID -} - -func (o *PostV1ServicesServiceIDChecklistResponseChecklistIDRequest) GetPostV1ServicesServiceIDChecklistResponseChecklistID() shared.PostV1ServicesServiceIDChecklistResponseChecklistID { - if o == nil { - return shared.PostV1ServicesServiceIDChecklistResponseChecklistID{} - } - return o.PostV1ServicesServiceIDChecklistResponseChecklistID -} - -type PostV1ServicesServiceIDChecklistResponseChecklistIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1ServicesServiceIDChecklistResponseChecklistIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ServicesServiceIDChecklistResponseChecklistIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ServicesServiceIDChecklistResponseChecklistIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1servicesservicelinks.go b/internal/sdk/models/operations/postv1servicesservicelinks.go deleted file mode 100644 index 4d649bc..0000000 --- a/internal/sdk/models/operations/postv1servicesservicelinks.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1ServicesServiceLinksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates a service with the appropriate integration for each external service ID passed - ServiceLinkEntities []shared.ServiceLinkEntity -} - -func (o *PostV1ServicesServiceLinksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1ServicesServiceLinksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1ServicesServiceLinksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1ServicesServiceLinksResponse) GetServiceLinkEntities() []shared.ServiceLinkEntity { - if o == nil { - return nil - } - return o.ServiceLinkEntities -} diff --git a/internal/sdk/models/operations/postv1severities.go b/internal/sdk/models/operations/postv1severities.go deleted file mode 100644 index 8d7a709..0000000 --- a/internal/sdk/models/operations/postv1severities.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1SeveritiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new severity - SeverityEntity *shared.SeverityEntity -} - -func (o *PostV1SeveritiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1SeveritiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1SeveritiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1SeveritiesResponse) GetSeverityEntity() *shared.SeverityEntity { - if o == nil { - return nil - } - return o.SeverityEntity -} diff --git a/internal/sdk/models/operations/postv1severitymatrixconditions.go b/internal/sdk/models/operations/postv1severitymatrixconditions.go deleted file mode 100644 index ad04a99..0000000 --- a/internal/sdk/models/operations/postv1severitymatrixconditions.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1SeverityMatrixConditionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new condition - SeverityMatrixConditionEntity *shared.SeverityMatrixConditionEntity -} - -func (o *PostV1SeverityMatrixConditionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1SeverityMatrixConditionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1SeverityMatrixConditionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1SeverityMatrixConditionsResponse) GetSeverityMatrixConditionEntity() *shared.SeverityMatrixConditionEntity { - if o == nil { - return nil - } - return o.SeverityMatrixConditionEntity -} diff --git a/internal/sdk/models/operations/postv1severitymatriximpacts.go b/internal/sdk/models/operations/postv1severitymatriximpacts.go deleted file mode 100644 index b0d1776..0000000 --- a/internal/sdk/models/operations/postv1severitymatriximpacts.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1SeverityMatrixImpactsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new impact - SeverityMatrixImpactEntity *shared.SeverityMatrixImpactEntity -} - -func (o *PostV1SeverityMatrixImpactsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1SeverityMatrixImpactsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1SeverityMatrixImpactsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1SeverityMatrixImpactsResponse) GetSeverityMatrixImpactEntity() *shared.SeverityMatrixImpactEntity { - if o == nil { - return nil - } - return o.SeverityMatrixImpactEntity -} diff --git a/internal/sdk/models/operations/postv1signalsdebugger.go b/internal/sdk/models/operations/postv1signalsdebugger.go deleted file mode 100644 index 4e604c1..0000000 --- a/internal/sdk/models/operations/postv1signalsdebugger.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PostV1SignalsDebuggerResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1SignalsDebuggerResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1SignalsDebuggerResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1SignalsDebuggerResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1signalsemailtargets.go b/internal/sdk/models/operations/postv1signalsemailtargets.go deleted file mode 100644 index 9e2e6fd..0000000 --- a/internal/sdk/models/operations/postv1signalsemailtargets.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type PostV1SignalsEmailTargetsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1SignalsEmailTargetsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1SignalsEmailTargetsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1SignalsEmailTargetsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1signalswebhooktargets.go b/internal/sdk/models/operations/postv1signalswebhooktargets.go deleted file mode 100644 index 640db8a..0000000 --- a/internal/sdk/models/operations/postv1signalswebhooktargets.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type CreatedBy struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Source *string `json:"source,omitempty"` - Email *string `json:"email,omitempty"` -} - -func (o *CreatedBy) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *CreatedBy) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *CreatedBy) GetSource() *string { - if o == nil { - return nil - } - return o.Source -} - -func (o *CreatedBy) GetEmail() *string { - if o == nil { - return nil - } - return o.Email -} - -// PostV1SignalsWebhookTargetsResponseBody - Create a Signals webhook target. -type PostV1SignalsWebhookTargetsResponseBody struct { - ID *string `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - State *string `json:"state,omitempty"` - CreatedBy *CreatedBy `json:"created_by,omitempty"` - CreatedAt *string `json:"created_at,omitempty"` - UpdatedAt *string `json:"updated_at,omitempty"` - Subscriptions *string `json:"subscriptions,omitempty"` -} - -func (o *PostV1SignalsWebhookTargetsResponseBody) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PostV1SignalsWebhookTargetsResponseBody) GetURL() *string { - if o == nil { - return nil - } - return o.URL -} - -func (o *PostV1SignalsWebhookTargetsResponseBody) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *PostV1SignalsWebhookTargetsResponseBody) GetCreatedBy() *CreatedBy { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *PostV1SignalsWebhookTargetsResponseBody) GetCreatedAt() *string { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *PostV1SignalsWebhookTargetsResponseBody) GetUpdatedAt() *string { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *PostV1SignalsWebhookTargetsResponseBody) GetSubscriptions() *string { - if o == nil { - return nil - } - return o.Subscriptions -} - -type PostV1SignalsWebhookTargetsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a Signals webhook target. - Object *PostV1SignalsWebhookTargetsResponseBody -} - -func (o *PostV1SignalsWebhookTargetsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1SignalsWebhookTargetsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1SignalsWebhookTargetsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1SignalsWebhookTargetsResponse) GetObject() *PostV1SignalsWebhookTargetsResponseBody { - if o == nil { - return nil - } - return o.Object -} diff --git a/internal/sdk/models/operations/postv1statusupdatetemplates.go b/internal/sdk/models/operations/postv1statusupdatetemplates.go deleted file mode 100644 index 2b2197d..0000000 --- a/internal/sdk/models/operations/postv1statusupdatetemplates.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1StatusUpdateTemplatesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a status update template for your organization - StatusUpdateTemplateEntity *shared.StatusUpdateTemplateEntity -} - -func (o *PostV1StatusUpdateTemplatesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1StatusUpdateTemplatesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1StatusUpdateTemplatesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1StatusUpdateTemplatesResponse) GetStatusUpdateTemplateEntity() *shared.StatusUpdateTemplateEntity { - if o == nil { - return nil - } - return o.StatusUpdateTemplateEntity -} diff --git a/internal/sdk/models/operations/postv1tasklists.go b/internal/sdk/models/operations/postv1tasklists.go deleted file mode 100644 index 3b68c2b..0000000 --- a/internal/sdk/models/operations/postv1tasklists.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TaskListsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates a new task list - TaskListEntity *shared.TaskListEntity -} - -func (o *PostV1TaskListsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TaskListsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TaskListsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1TaskListsResponse) GetTaskListEntity() *shared.TaskListEntity { - if o == nil { - return nil - } - return o.TaskListEntity -} diff --git a/internal/sdk/models/operations/postv1teams.go b/internal/sdk/models/operations/postv1teams.go deleted file mode 100644 index 625023e..0000000 --- a/internal/sdk/models/operations/postv1teams.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TeamsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new team - TeamEntity *shared.TeamEntity -} - -func (o *PostV1TeamsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TeamsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TeamsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1TeamsResponse) GetTeamEntity() *shared.TeamEntity { - if o == nil { - return nil - } - return o.TeamEntity -} diff --git a/internal/sdk/models/operations/postv1teamsteamidescalationpolicies.go b/internal/sdk/models/operations/postv1teamsteamidescalationpolicies.go deleted file mode 100644 index d6c755f..0000000 --- a/internal/sdk/models/operations/postv1teamsteamidescalationpolicies.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TeamsTeamIDEscalationPoliciesRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - PostV1TeamsTeamIDEscalationPolicies shared.PostV1TeamsTeamIDEscalationPolicies `request:"mediaType=application/json"` -} - -func (o *PostV1TeamsTeamIDEscalationPoliciesRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PostV1TeamsTeamIDEscalationPoliciesRequest) GetPostV1TeamsTeamIDEscalationPolicies() shared.PostV1TeamsTeamIDEscalationPolicies { - if o == nil { - return shared.PostV1TeamsTeamIDEscalationPolicies{} - } - return o.PostV1TeamsTeamIDEscalationPolicies -} - -type PostV1TeamsTeamIDEscalationPoliciesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1TeamsTeamIDEscalationPoliciesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TeamsTeamIDEscalationPoliciesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TeamsTeamIDEscalationPoliciesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1teamsteamidoncallschedules.go b/internal/sdk/models/operations/postv1teamsteamidoncallschedules.go deleted file mode 100644 index 5b5d0e1..0000000 --- a/internal/sdk/models/operations/postv1teamsteamidoncallschedules.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TeamsTeamIDOnCallSchedulesRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - PostV1TeamsTeamIDOnCallSchedules shared.PostV1TeamsTeamIDOnCallSchedules `request:"mediaType=application/json"` -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesRequest) GetPostV1TeamsTeamIDOnCallSchedules() shared.PostV1TeamsTeamIDOnCallSchedules { - if o == nil { - return shared.PostV1TeamsTeamIDOnCallSchedules{} - } - return o.PostV1TeamsTeamIDOnCallSchedules -} - -type PostV1TeamsTeamIDOnCallSchedulesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1teamsteamidoncallschedulesscheduleidshifts.go b/internal/sdk/models/operations/postv1teamsteamidoncallschedulesscheduleidshifts.go deleted file mode 100644 index f442701..0000000 --- a/internal/sdk/models/operations/postv1teamsteamidoncallschedulesscheduleidshifts.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - ScheduleID string `pathParam:"style=simple,explode=false,name=schedule_id"` - PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts shared.PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts `request:"mediaType=application/json"` -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsRequest) GetScheduleID() string { - if o == nil { - return "" - } - return o.ScheduleID -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsRequest) GetPostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts() shared.PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts { - if o == nil { - return shared.PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts{} - } - return o.PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts -} - -type PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1teamsteamidsignalrules.go b/internal/sdk/models/operations/postv1teamsteamidsignalrules.go deleted file mode 100644 index de9c81c..0000000 --- a/internal/sdk/models/operations/postv1teamsteamidsignalrules.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TeamsTeamIDSignalRulesRequest struct { - TeamID string `pathParam:"style=simple,explode=false,name=team_id"` - PostV1TeamsTeamIDSignalRules shared.PostV1TeamsTeamIDSignalRules `request:"mediaType=application/json"` -} - -func (o *PostV1TeamsTeamIDSignalRulesRequest) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} - -func (o *PostV1TeamsTeamIDSignalRulesRequest) GetPostV1TeamsTeamIDSignalRules() shared.PostV1TeamsTeamIDSignalRules { - if o == nil { - return shared.PostV1TeamsTeamIDSignalRules{} - } - return o.PostV1TeamsTeamIDSignalRules -} - -type PostV1TeamsTeamIDSignalRulesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PostV1TeamsTeamIDSignalRulesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TeamsTeamIDSignalRulesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TeamsTeamIDSignalRulesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/postv1ticketingpriorities.go b/internal/sdk/models/operations/postv1ticketingpriorities.go deleted file mode 100644 index 00e3ee3..0000000 --- a/internal/sdk/models/operations/postv1ticketingpriorities.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TicketingPrioritiesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a single ticketing priority - TicketingPriorityEntity *shared.TicketingPriorityEntity -} - -func (o *PostV1TicketingPrioritiesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TicketingPrioritiesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TicketingPrioritiesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1TicketingPrioritiesResponse) GetTicketingPriorityEntity() *shared.TicketingPriorityEntity { - if o == nil { - return nil - } - return o.TicketingPriorityEntity -} diff --git a/internal/sdk/models/operations/postv1ticketingprojectsticketingprojectidfieldmaps.go b/internal/sdk/models/operations/postv1ticketingprojectsticketingprojectidfieldmaps.go deleted file mode 100644 index e059c3b..0000000 --- a/internal/sdk/models/operations/postv1ticketingprojectsticketingprojectidfieldmaps.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TicketingProjectsTicketingProjectIDFieldMapsRequest struct { - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *PostV1TicketingProjectsTicketingProjectIDFieldMapsRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type PostV1TicketingProjectsTicketingProjectIDFieldMapsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates field map for a ticketing project - TicketingProjectFieldMapEntity *shared.TicketingProjectFieldMapEntity -} - -func (o *PostV1TicketingProjectsTicketingProjectIDFieldMapsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TicketingProjectsTicketingProjectIDFieldMapsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TicketingProjectsTicketingProjectIDFieldMapsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1TicketingProjectsTicketingProjectIDFieldMapsResponse) GetTicketingProjectFieldMapEntity() *shared.TicketingProjectFieldMapEntity { - if o == nil { - return nil - } - return o.TicketingProjectFieldMapEntity -} diff --git a/internal/sdk/models/operations/postv1ticketingprojectsticketingprojectidproviderprojectconfigurations.go b/internal/sdk/models/operations/postv1ticketingprojectsticketingprojectidproviderprojectconfigurations.go deleted file mode 100644 index ff64e4d..0000000 --- a/internal/sdk/models/operations/postv1ticketingprojectsticketingprojectidproviderprojectconfigurations.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsRequest struct { - TicketingProjectID string `pathParam:"style=simple,explode=false,name=ticketing_project_id"` -} - -func (o *PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsRequest) GetTicketingProjectID() string { - if o == nil { - return "" - } - return o.TicketingProjectID -} - -type PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates configuration for a ticketing project - TicketingProjectConfigEntity *shared.TicketingProjectConfigEntity -} - -func (o *PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsResponse) GetTicketingProjectConfigEntity() *shared.TicketingProjectConfigEntity { - if o == nil { - return nil - } - return o.TicketingProjectConfigEntity -} diff --git a/internal/sdk/models/operations/postv1ticketingtickets.go b/internal/sdk/models/operations/postv1ticketingtickets.go deleted file mode 100644 index c01c254..0000000 --- a/internal/sdk/models/operations/postv1ticketingtickets.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1TicketingTicketsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Creates a ticket for a project - TicketingTicketEntity *shared.TicketingTicketEntity -} - -func (o *PostV1TicketingTicketsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1TicketingTicketsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1TicketingTicketsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1TicketingTicketsResponse) GetTicketingTicketEntity() *shared.TicketingTicketEntity { - if o == nil { - return nil - } - return o.TicketingTicketEntity -} diff --git a/internal/sdk/models/operations/postv1webhooks.go b/internal/sdk/models/operations/postv1webhooks.go deleted file mode 100644 index 0268102..0000000 --- a/internal/sdk/models/operations/postv1webhooks.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PostV1WebhooksResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Create a new webhook - WebhooksEntitiesWebhookEntity *shared.WebhooksEntitiesWebhookEntity -} - -func (o *PostV1WebhooksResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PostV1WebhooksResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PostV1WebhooksResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PostV1WebhooksResponse) GetWebhooksEntitiesWebhookEntity() *shared.WebhooksEntitiesWebhookEntity { - if o == nil { - return nil - } - return o.WebhooksEntitiesWebhookEntity -} diff --git a/internal/sdk/models/operations/putv1aisummarizeincidentincidentidgeneratedsummaryidvote.go b/internal/sdk/models/operations/putv1aisummarizeincidentincidentidgeneratedsummaryidvote.go deleted file mode 100644 index 3903f0a..0000000 --- a/internal/sdk/models/operations/putv1aisummarizeincidentincidentidgeneratedsummaryidvote.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "net/http" -) - -type Direction string - -const ( - DirectionUp Direction = "up" - DirectionDown Direction = "down" -) - -func (e Direction) ToPointer() *Direction { - return &e -} -func (e *Direction) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "up": - fallthrough - case "down": - *e = Direction(v) - return nil - default: - return fmt.Errorf("invalid value for Direction: %v", v) - } -} - -type PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequestBody struct { - Direction Direction `form:"name=direction"` -} - -func (o *PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequestBody) GetDirection() Direction { - if o == nil { - return Direction("") - } - return o.Direction -} - -type PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - GeneratedSummaryID string `pathParam:"style=simple,explode=false,name=generated_summary_id"` - RequestBody PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequest) GetGeneratedSummaryID() string { - if o == nil { - return "" - } - return o.GeneratedSummaryID -} - -func (o *PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequest) GetRequestBody() PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequestBody { - if o == nil { - return PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteRequestBody{} - } - return o.RequestBody -} - -type PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1AiSummarizeIncidentIncidentIDGeneratedSummaryIDVoteResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/putv1incidentsincidentidclose.go b/internal/sdk/models/operations/putv1incidentsincidentidclose.go deleted file mode 100644 index bab9b14..0000000 --- a/internal/sdk/models/operations/putv1incidentsincidentidclose.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1IncidentsIncidentIDCloseRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` -} - -func (o *PutV1IncidentsIncidentIDCloseRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -type PutV1IncidentsIncidentIDCloseResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Closes an incident and optionally close all children - IncidentEntity *shared.IncidentEntity -} - -func (o *PutV1IncidentsIncidentIDCloseResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1IncidentsIncidentIDCloseResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1IncidentsIncidentIDCloseResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1IncidentsIncidentIDCloseResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/putv1incidentsincidentidimpact.go b/internal/sdk/models/operations/putv1incidentsincidentidimpact.go deleted file mode 100644 index e577c5b..0000000 --- a/internal/sdk/models/operations/putv1incidentsincidentidimpact.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1IncidentsIncidentIDImpactRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PutV1IncidentsIncidentIDImpact shared.PutV1IncidentsIncidentIDImpact `request:"mediaType=application/json"` -} - -func (o *PutV1IncidentsIncidentIDImpactRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PutV1IncidentsIncidentIDImpactRequest) GetPutV1IncidentsIncidentIDImpact() shared.PutV1IncidentsIncidentIDImpact { - if o == nil { - return shared.PutV1IncidentsIncidentIDImpact{} - } - return o.PutV1IncidentsIncidentIDImpact -} - -type PutV1IncidentsIncidentIDImpactResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Allows updating an incident's impacted infrastructure, with the option to - // move the incident into a different milestone and provide a note to update - // the incident timeline and any attached status pages. If this method is - // requested with the PUT verb, impacts will be completely replaced with the - // information in the request body, even if not provided (effectively clearing - // all impacts). If this method is requested with the PATCH verb, the provided - // impacts will be added or updated, but no impacts will be removed. - // - IncidentEntity *shared.IncidentEntity -} - -func (o *PutV1IncidentsIncidentIDImpactResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1IncidentsIncidentIDImpactResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1IncidentsIncidentIDImpactResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1IncidentsIncidentIDImpactResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/putv1incidentsincidentidlinkslinkid.go b/internal/sdk/models/operations/putv1incidentsincidentidlinkslinkid.go deleted file mode 100644 index 1217f5b..0000000 --- a/internal/sdk/models/operations/putv1incidentsincidentidlinkslinkid.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1IncidentsIncidentIDLinksLinkIDRequest struct { - LinkID string `pathParam:"style=simple,explode=false,name=link_id"` - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PutV1IncidentsIncidentIDLinksLinkID shared.PutV1IncidentsIncidentIDLinksLinkID `request:"mediaType=application/json"` -} - -func (o *PutV1IncidentsIncidentIDLinksLinkIDRequest) GetLinkID() string { - if o == nil { - return "" - } - return o.LinkID -} - -func (o *PutV1IncidentsIncidentIDLinksLinkIDRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PutV1IncidentsIncidentIDLinksLinkIDRequest) GetPutV1IncidentsIncidentIDLinksLinkID() shared.PutV1IncidentsIncidentIDLinksLinkID { - if o == nil { - return shared.PutV1IncidentsIncidentIDLinksLinkID{} - } - return o.PutV1IncidentsIncidentIDLinksLinkID -} - -type PutV1IncidentsIncidentIDLinksLinkIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PutV1IncidentsIncidentIDLinksLinkIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1IncidentsIncidentIDLinksLinkIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1IncidentsIncidentIDLinksLinkIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/putv1incidentsincidentidmilestonesbulkupdate.go b/internal/sdk/models/operations/putv1incidentsincidentidmilestonesbulkupdate.go deleted file mode 100644 index 467df37..0000000 --- a/internal/sdk/models/operations/putv1incidentsincidentidmilestonesbulkupdate.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1IncidentsIncidentIDMilestonesBulkUpdateRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - PutV1IncidentsIncidentIDMilestonesBulkUpdate shared.PutV1IncidentsIncidentIDMilestonesBulkUpdate `request:"mediaType=application/json"` -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateRequest) GetPutV1IncidentsIncidentIDMilestonesBulkUpdate() shared.PutV1IncidentsIncidentIDMilestonesBulkUpdate { - if o == nil { - return shared.PutV1IncidentsIncidentIDMilestonesBulkUpdate{} - } - return o.PutV1IncidentsIncidentIDMilestonesBulkUpdate -} - -type PutV1IncidentsIncidentIDMilestonesBulkUpdateResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update milestone times in bulk for a given incident. All milestone - // times for an incident must occur in chronological order - // corresponding to the configured order of milestones. If the result - // of this request would cause any milestone(s) to appear out of place, - // a 422 response will instead be returned. This includes milestones - // not explicitly submitted or updated in this request. - // - IncidentsMilestoneEntityPaginated *shared.IncidentsMilestoneEntityPaginated -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateResponse) GetIncidentsMilestoneEntityPaginated() *shared.IncidentsMilestoneEntityPaginated { - if o == nil { - return nil - } - return o.IncidentsMilestoneEntityPaginated -} diff --git a/internal/sdk/models/operations/putv1incidentsincidentidresolve.go b/internal/sdk/models/operations/putv1incidentsincidentidresolve.go deleted file mode 100644 index 77342bd..0000000 --- a/internal/sdk/models/operations/putv1incidentsincidentidresolve.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1IncidentsIncidentIDResolveRequestBody struct { - // The slug of any milestone in the post-incident or closed phase to set on the incident (and its children, if `resolve_children` os set). Must be one of the configured milestones available on this incident. - Milestone *string `form:"name=milestone"` -} - -func (o *PutV1IncidentsIncidentIDResolveRequestBody) GetMilestone() *string { - if o == nil { - return nil - } - return o.Milestone -} - -type PutV1IncidentsIncidentIDResolveRequest struct { - IncidentID string `pathParam:"style=simple,explode=false,name=incident_id"` - RequestBody *PutV1IncidentsIncidentIDResolveRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PutV1IncidentsIncidentIDResolveRequest) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} - -func (o *PutV1IncidentsIncidentIDResolveRequest) GetRequestBody() *PutV1IncidentsIncidentIDResolveRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type PutV1IncidentsIncidentIDResolveResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Resolves a currently active incident - IncidentEntity *shared.IncidentEntity -} - -func (o *PutV1IncidentsIncidentIDResolveResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1IncidentsIncidentIDResolveResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1IncidentsIncidentIDResolveResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1IncidentsIncidentIDResolveResponse) GetIncidentEntity() *shared.IncidentEntity { - if o == nil { - return nil - } - return o.IncidentEntity -} diff --git a/internal/sdk/models/operations/putv1nuncconnectionsnuncconnectionid.go b/internal/sdk/models/operations/putv1nuncconnectionsnuncconnectionid.go deleted file mode 100644 index fe1f3f6..0000000 --- a/internal/sdk/models/operations/putv1nuncconnectionsnuncconnectionid.go +++ /dev/null @@ -1,199 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1NuncConnectionsNuncConnectionIDRequestBody struct { - CompanyName *string `form:"name=company_name"` - CompanyWebsite *string `form:"name=company_website"` - CompanyTosURL *string `form:"name=company_tos_url"` - GreetingTitle *string `form:"name=greeting_title"` - GreetingBody *string `form:"name=greeting_body"` - OperationalMessage *string `form:"name=operational_message"` - Title *string `form:"name=title"` - // Status page condition to map your severity matrix condition to - ConditionsNuncCondition []string `form:"name=conditions[nunc_condition]"` - // Severity matrix condition id - ConditionsConditionID []string `form:"name=conditions[condition_id]"` - ComponentsInfrastructureType []string `form:"name=components[infrastructure_type]"` - ComponentsInfrastructureID []string `form:"name=components[infrastructure_id]"` - PrimaryColor *string `form:"name=primary_color"` - SecondaryColor *string `form:"name=secondary_color"` - ExposedFields []string `form:"name=exposed_fields"` - EnableHistogram *bool `form:"name=enable_histogram"` - UIVersion *int `form:"name=ui_version"` -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetCompanyName() *string { - if o == nil { - return nil - } - return o.CompanyName -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetCompanyWebsite() *string { - if o == nil { - return nil - } - return o.CompanyWebsite -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetCompanyTosURL() *string { - if o == nil { - return nil - } - return o.CompanyTosURL -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetGreetingTitle() *string { - if o == nil { - return nil - } - return o.GreetingTitle -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetGreetingBody() *string { - if o == nil { - return nil - } - return o.GreetingBody -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetOperationalMessage() *string { - if o == nil { - return nil - } - return o.OperationalMessage -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetConditionsNuncCondition() []string { - if o == nil { - return []string{} - } - return o.ConditionsNuncCondition -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetConditionsConditionID() []string { - if o == nil { - return []string{} - } - return o.ConditionsConditionID -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetComponentsInfrastructureType() []string { - if o == nil { - return []string{} - } - return o.ComponentsInfrastructureType -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetComponentsInfrastructureID() []string { - if o == nil { - return []string{} - } - return o.ComponentsInfrastructureID -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetPrimaryColor() *string { - if o == nil { - return nil - } - return o.PrimaryColor -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetSecondaryColor() *string { - if o == nil { - return nil - } - return o.SecondaryColor -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetExposedFields() []string { - if o == nil { - return nil - } - return o.ExposedFields -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetEnableHistogram() *bool { - if o == nil { - return nil - } - return o.EnableHistogram -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequestBody) GetUIVersion() *int { - if o == nil { - return nil - } - return o.UIVersion -} - -type PutV1NuncConnectionsNuncConnectionIDRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - RequestBody *PutV1NuncConnectionsNuncConnectionIDRequestBody `request:"mediaType=application/x-www-form-urlencoded"` -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *PutV1NuncConnectionsNuncConnectionIDRequest) GetRequestBody() *PutV1NuncConnectionsNuncConnectionIDRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type PutV1NuncConnectionsNuncConnectionIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update your company's information and other components in the specified FireHydrant hosted status page. - NuncConnectionEntity *shared.NuncConnectionEntity -} - -func (o *PutV1NuncConnectionsNuncConnectionIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1NuncConnectionsNuncConnectionIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1NuncConnectionsNuncConnectionIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1NuncConnectionsNuncConnectionIDResponse) GetNuncConnectionEntity() *shared.NuncConnectionEntity { - if o == nil { - return nil - } - return o.NuncConnectionEntity -} diff --git a/internal/sdk/models/operations/putv1nuncconnectionsnuncconnectionidimagestype.go b/internal/sdk/models/operations/putv1nuncconnectionsnuncconnectionidimagestype.go deleted file mode 100644 index 7515217..0000000 --- a/internal/sdk/models/operations/putv1nuncconnectionsnuncconnectionidimagestype.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1NuncConnectionsNuncConnectionIDImagesTypeFile struct { - FileName string `multipartForm:"name=file"` - Content []byte `multipartForm:"content"` -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeFile) GetFileName() string { - if o == nil { - return "" - } - return o.FileName -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeFile) GetContent() []byte { - if o == nil { - return []byte{} - } - return o.Content -} - -type PutV1NuncConnectionsNuncConnectionIDImagesTypeRequestBody struct { - File *PutV1NuncConnectionsNuncConnectionIDImagesTypeFile `multipartForm:"file"` -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeRequestBody) GetFile() *PutV1NuncConnectionsNuncConnectionIDImagesTypeFile { - if o == nil { - return nil - } - return o.File -} - -type PutV1NuncConnectionsNuncConnectionIDImagesTypeRequest struct { - NuncConnectionID string `pathParam:"style=simple,explode=false,name=nunc_connection_id"` - Type string `pathParam:"style=simple,explode=false,name=type"` - RequestBody *PutV1NuncConnectionsNuncConnectionIDImagesTypeRequestBody `request:"mediaType=multipart/form-data"` -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeRequest) GetNuncConnectionID() string { - if o == nil { - return "" - } - return o.NuncConnectionID -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeRequest) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeRequest) GetRequestBody() *PutV1NuncConnectionsNuncConnectionIDImagesTypeRequestBody { - if o == nil { - return nil - } - return o.RequestBody -} - -type PutV1NuncConnectionsNuncConnectionIDImagesTypeResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Add or replace an image attached to a FireHydrant status page - NuncConnectionEntity *shared.NuncConnectionEntity -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1NuncConnectionsNuncConnectionIDImagesTypeResponse) GetNuncConnectionEntity() *shared.NuncConnectionEntity { - if o == nil { - return nil - } - return o.NuncConnectionEntity -} diff --git a/internal/sdk/models/operations/putv1postmortemsquestions.go b/internal/sdk/models/operations/putv1postmortemsquestions.go deleted file mode 100644 index 64c0fd5..0000000 --- a/internal/sdk/models/operations/putv1postmortemsquestions.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1PostMortemsQuestionsResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update the questions configured to be provided and filled out on future retrospective reports. - PostMortemsQuestionTypeEntity *shared.PostMortemsQuestionTypeEntity -} - -func (o *PutV1PostMortemsQuestionsResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1PostMortemsQuestionsResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1PostMortemsQuestionsResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1PostMortemsQuestionsResponse) GetPostMortemsQuestionTypeEntity() *shared.PostMortemsQuestionTypeEntity { - if o == nil { - return nil - } - return o.PostMortemsQuestionTypeEntity -} diff --git a/internal/sdk/models/operations/putv1postmortemsreportsreportidreasonsorder.go b/internal/sdk/models/operations/putv1postmortemsreportsreportidreasonsorder.go deleted file mode 100644 index c0a7aba..0000000 --- a/internal/sdk/models/operations/putv1postmortemsreportsreportidreasonsorder.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1PostMortemsReportsReportIDReasonsOrderRequest struct { - ReportID string `pathParam:"style=simple,explode=false,name=report_id"` - PutV1PostMortemsReportsReportIDReasonsOrder shared.PutV1PostMortemsReportsReportIDReasonsOrder `request:"mediaType=application/json"` -} - -func (o *PutV1PostMortemsReportsReportIDReasonsOrderRequest) GetReportID() string { - if o == nil { - return "" - } - return o.ReportID -} - -func (o *PutV1PostMortemsReportsReportIDReasonsOrderRequest) GetPutV1PostMortemsReportsReportIDReasonsOrder() shared.PutV1PostMortemsReportsReportIDReasonsOrder { - if o == nil { - return shared.PutV1PostMortemsReportsReportIDReasonsOrder{} - } - return o.PutV1PostMortemsReportsReportIDReasonsOrder -} - -type PutV1PostMortemsReportsReportIDReasonsOrderResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Reorder a contributing factor - PostMortemsReasonEntity *shared.PostMortemsReasonEntity -} - -func (o *PutV1PostMortemsReportsReportIDReasonsOrderResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1PostMortemsReportsReportIDReasonsOrderResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1PostMortemsReportsReportIDReasonsOrderResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1PostMortemsReportsReportIDReasonsOrderResponse) GetPostMortemsReasonEntity() *shared.PostMortemsReasonEntity { - if o == nil { - return nil - } - return o.PostMortemsReasonEntity -} diff --git a/internal/sdk/models/operations/putv1runbooksexecutionsexecutionidstepsstepid.go b/internal/sdk/models/operations/putv1runbooksexecutionsexecutionidstepsstepid.go deleted file mode 100644 index 34b2d98..0000000 --- a/internal/sdk/models/operations/putv1runbooksexecutionsexecutionidstepsstepid.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1RunbooksExecutionsExecutionIDStepsStepIDRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` - StepID string `pathParam:"style=simple,explode=false,name=step_id"` - PutV1RunbooksExecutionsExecutionIDStepsStepID shared.PutV1RunbooksExecutionsExecutionIDStepsStepID `request:"mediaType=application/json"` -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDRequest) GetStepID() string { - if o == nil { - return "" - } - return o.StepID -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDRequest) GetPutV1RunbooksExecutionsExecutionIDStepsStepID() shared.PutV1RunbooksExecutionsExecutionIDStepsStepID { - if o == nil { - return shared.PutV1RunbooksExecutionsExecutionIDStepsStepID{} - } - return o.PutV1RunbooksExecutionsExecutionIDStepsStepID -} - -type PutV1RunbooksExecutionsExecutionIDStepsStepIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Updates a runbook step execution, especially for changing the state of a step execution. - RunbooksExecutionEntity *shared.RunbooksExecutionEntity -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDResponse) GetRunbooksExecutionEntity() *shared.RunbooksExecutionEntity { - if o == nil { - return nil - } - return o.RunbooksExecutionEntity -} diff --git a/internal/sdk/models/operations/putv1runbooksexecutionsexecutionidstepsstepidscriptstate.go b/internal/sdk/models/operations/putv1runbooksexecutionsexecutionidstepsstepidscriptstate.go deleted file mode 100644 index 8281a0a..0000000 --- a/internal/sdk/models/operations/putv1runbooksexecutionsexecutionidstepsstepidscriptstate.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateRequest struct { - ExecutionID string `pathParam:"style=simple,explode=false,name=execution_id"` - StepID string `pathParam:"style=simple,explode=false,name=step_id"` - State string `pathParam:"style=simple,explode=false,name=state"` -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateRequest) GetExecutionID() string { - if o == nil { - return "" - } - return o.ExecutionID -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateRequest) GetStepID() string { - if o == nil { - return "" - } - return o.StepID -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateRequest) GetState() string { - if o == nil { - return "" - } - return o.State -} - -type PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Updates the execution's step. - RunbooksExecutionEntity *shared.RunbooksExecutionEntity -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateResponse) GetRunbooksExecutionEntity() *shared.RunbooksExecutionEntity { - if o == nil { - return nil - } - return o.RunbooksExecutionEntity -} diff --git a/internal/sdk/models/operations/putv1runbooksrunbookid.go b/internal/sdk/models/operations/putv1runbooksrunbookid.go deleted file mode 100644 index ed4ce5b..0000000 --- a/internal/sdk/models/operations/putv1runbooksrunbookid.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1RunbooksRunbookIDRequest struct { - RunbookID string `pathParam:"style=simple,explode=false,name=runbook_id"` - PutV1RunbooksRunbookID shared.PutV1RunbooksRunbookID `request:"mediaType=application/json"` -} - -func (o *PutV1RunbooksRunbookIDRequest) GetRunbookID() string { - if o == nil { - return "" - } - return o.RunbookID -} - -func (o *PutV1RunbooksRunbookIDRequest) GetPutV1RunbooksRunbookID() shared.PutV1RunbooksRunbookID { - if o == nil { - return shared.PutV1RunbooksRunbookID{} - } - return o.PutV1RunbooksRunbookID -} - -type PutV1RunbooksRunbookIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Update a runbook and any attachment rules associated with it. This endpoint is used to configure nearly everything - // about a runbook, including but not limited to the steps, environments, attachment rules, and severities. - // - RunbookEntity *shared.RunbookEntity -} - -func (o *PutV1RunbooksRunbookIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1RunbooksRunbookIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1RunbooksRunbookIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *PutV1RunbooksRunbookIDResponse) GetRunbookEntity() *shared.RunbookEntity { - if o == nil { - return nil - } - return o.RunbookEntity -} diff --git a/internal/sdk/models/operations/putv1scimv2groupsid.go b/internal/sdk/models/operations/putv1scimv2groupsid.go deleted file mode 100644 index 58a13e0..0000000 --- a/internal/sdk/models/operations/putv1scimv2groupsid.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1ScimV2GroupsIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PutV1ScimV2GroupsID shared.PutV1ScimV2GroupsID `request:"mediaType=application/scim+json"` -} - -func (o *PutV1ScimV2GroupsIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PutV1ScimV2GroupsIDRequest) GetPutV1ScimV2GroupsID() shared.PutV1ScimV2GroupsID { - if o == nil { - return shared.PutV1ScimV2GroupsID{} - } - return o.PutV1ScimV2GroupsID -} - -type PutV1ScimV2GroupsIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PutV1ScimV2GroupsIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1ScimV2GroupsIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1ScimV2GroupsIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/operations/putv1scimv2usersid.go b/internal/sdk/models/operations/putv1scimv2usersid.go deleted file mode 100644 index e5e4bc2..0000000 --- a/internal/sdk/models/operations/putv1scimv2usersid.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type PutV1ScimV2UsersIDRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PutV1ScimV2UsersID shared.PutV1ScimV2UsersID `request:"mediaType=application/scim+json"` -} - -func (o *PutV1ScimV2UsersIDRequest) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PutV1ScimV2UsersIDRequest) GetPutV1ScimV2UsersID() shared.PutV1ScimV2UsersID { - if o == nil { - return shared.PutV1ScimV2UsersID{} - } - return o.PutV1ScimV2UsersID -} - -type PutV1ScimV2UsersIDResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *PutV1ScimV2UsersIDResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *PutV1ScimV2UsersIDResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *PutV1ScimV2UsersIDResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/internal/sdk/models/shared/actorentity.go b/internal/sdk/models/shared/actorentity.go deleted file mode 100644 index 00a3ca8..0000000 --- a/internal/sdk/models/shared/actorentity.go +++ /dev/null @@ -1,174 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type Type string - -const ( - TypeFirehydrantUser Type = "firehydrant_user" - TypeFirehydrantBot Type = "firehydrant_bot" - TypeAlertmanager Type = "alertmanager" - TypeAsana Type = "asana" - TypeAws Type = "aws" - TypeBugsnag Type = "bugsnag" - TypeCheckly Type = "checkly" - TypeCustomAlerts Type = "custom_alerts" - TypeDatadog Type = "datadog" - TypeShortcut Type = "shortcut" - TypeNewRelic Type = "new_relic" - TypeNunc Type = "nunc" - TypeGithub Type = "github" - TypeGiphy Type = "giphy" - TypeGoogleMeet Type = "google_meet" - TypeGoogleCalendar Type = "google_calendar" - TypeMicrosoftTeams Type = "microsoft_teams" - TypeMicrosoftTeamsV2 Type = "microsoft_teams_v2" - TypeWebex Type = "webex" - TypeJiraCloud Type = "jira_cloud" - TypeJiraOnprem Type = "jira_onprem" - TypeOpsgenie Type = "opsgenie" - TypePagerDuty Type = "pager_duty" - TypeHoneycomb Type = "honeycomb" - TypePatchy Type = "patchy" - TypeServiceNow Type = "service_now" - TypeSignals Type = "signals" - TypeSlack Type = "slack" - TypeStatuspage Type = "statuspage" - TypeVictorops Type = "victorops" - TypeZendesk Type = "zendesk" - TypeZoom Type = "zoom" - TypeConfluenceCloud Type = "confluence_cloud" - TypeGoogleDocs Type = "google_docs" - TypeZoomV2 Type = "zoom_v2" - TypeLinear Type = "linear" - TypeCortex Type = "cortex" -) - -func (e Type) ToPointer() *Type { - return &e -} -func (e *Type) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "firehydrant_user": - fallthrough - case "firehydrant_bot": - fallthrough - case "alertmanager": - fallthrough - case "asana": - fallthrough - case "aws": - fallthrough - case "bugsnag": - fallthrough - case "checkly": - fallthrough - case "custom_alerts": - fallthrough - case "datadog": - fallthrough - case "shortcut": - fallthrough - case "new_relic": - fallthrough - case "nunc": - fallthrough - case "github": - fallthrough - case "giphy": - fallthrough - case "google_meet": - fallthrough - case "google_calendar": - fallthrough - case "microsoft_teams": - fallthrough - case "microsoft_teams_v2": - fallthrough - case "webex": - fallthrough - case "jira_cloud": - fallthrough - case "jira_onprem": - fallthrough - case "opsgenie": - fallthrough - case "pager_duty": - fallthrough - case "honeycomb": - fallthrough - case "patchy": - fallthrough - case "service_now": - fallthrough - case "signals": - fallthrough - case "slack": - fallthrough - case "statuspage": - fallthrough - case "victorops": - fallthrough - case "zendesk": - fallthrough - case "zoom": - fallthrough - case "confluence_cloud": - fallthrough - case "google_docs": - fallthrough - case "zoom_v2": - fallthrough - case "linear": - fallthrough - case "cortex": - *e = Type(v) - return nil - default: - return fmt.Errorf("invalid value for Type: %v", v) - } -} - -type ActorEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Email *string `json:"email,omitempty"` - Type *Type `json:"type,omitempty"` -} - -func (o *ActorEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ActorEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *ActorEntity) GetEmail() *string { - if o == nil { - return nil - } - return o.Email -} - -func (o *ActorEntity) GetType() *Type { - if o == nil { - return nil - } - return o.Type -} diff --git a/internal/sdk/models/shared/aientitiespreferencesentity.go b/internal/sdk/models/shared/aientitiespreferencesentity.go deleted file mode 100644 index e351a85..0000000 --- a/internal/sdk/models/shared/aientitiespreferencesentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// AIEntitiesPreferencesEntity - AI_Entities_PreferencesEntity model -type AIEntitiesPreferencesEntity struct { - Ai *bool `json:"ai,omitempty"` - Description *bool `json:"description,omitempty"` - Followups *bool `json:"followups,omitempty"` - Impact *bool `json:"impact,omitempty"` - Retros *bool `json:"retros,omitempty"` - SimilarIncidents *bool `json:"similar_incidents,omitempty"` - Summaries *bool `json:"summaries,omitempty"` - Updates *bool `json:"updates,omitempty"` -} - -func (o *AIEntitiesPreferencesEntity) GetAi() *bool { - if o == nil { - return nil - } - return o.Ai -} - -func (o *AIEntitiesPreferencesEntity) GetDescription() *bool { - if o == nil { - return nil - } - return o.Description -} - -func (o *AIEntitiesPreferencesEntity) GetFollowups() *bool { - if o == nil { - return nil - } - return o.Followups -} - -func (o *AIEntitiesPreferencesEntity) GetImpact() *bool { - if o == nil { - return nil - } - return o.Impact -} - -func (o *AIEntitiesPreferencesEntity) GetRetros() *bool { - if o == nil { - return nil - } - return o.Retros -} - -func (o *AIEntitiesPreferencesEntity) GetSimilarIncidents() *bool { - if o == nil { - return nil - } - return o.SimilarIncidents -} - -func (o *AIEntitiesPreferencesEntity) GetSummaries() *bool { - if o == nil { - return nil - } - return o.Summaries -} - -func (o *AIEntitiesPreferencesEntity) GetUpdates() *bool { - if o == nil { - return nil - } - return o.Updates -} diff --git a/internal/sdk/models/shared/alertsalertentity.go b/internal/sdk/models/shared/alertsalertentity.go deleted file mode 100644 index 9a2718c..0000000 --- a/internal/sdk/models/shared/alertsalertentity.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// AlertsAlertEntity - Alerts_AlertEntity model -type AlertsAlertEntity struct { - ID *string `json:"id,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - Priority *string `json:"priority,omitempty"` - IntegrationName *string `json:"integration_name,omitempty"` - StartsAt *time.Time `json:"starts_at,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` - DurationMs *int `json:"duration_ms,omitempty"` - DurationIso8601 *string `json:"duration_iso8601,omitempty"` - Status *string `json:"status,omitempty"` - RemoteID *string `json:"remote_id,omitempty"` - RemoteURL *string `json:"remote_url,omitempty"` - // Arbitrary key:value pairs of labels. - Labels map[string]string `json:"labels,omitempty"` - Environments []SuccinctEntity `json:"environments,omitempty"` - Services []SuccinctEntity `json:"services,omitempty"` - Tags []string `json:"tags,omitempty"` - SourceIcon *string `json:"source_icon,omitempty"` - SignalID *string `json:"signal_id,omitempty"` - SignalRule *SignalsAPIRuleEntity `json:"signal_rule,omitempty"` - TeamName *string `json:"team_name,omitempty"` - TeamID *string `json:"team_id,omitempty"` - Position *int `json:"position,omitempty"` - Incidents []PublicAPIV1IncidentsSuccinctEntity `json:"incidents,omitempty"` - Events []AlertsSirenEventEntity `json:"events,omitempty"` - IsExpired *bool `json:"is_expired,omitempty"` -} - -func (a AlertsAlertEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(a, "", false) -} - -func (a *AlertsAlertEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { - return err - } - return nil -} - -func (o *AlertsAlertEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *AlertsAlertEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *AlertsAlertEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *AlertsAlertEntity) GetPriority() *string { - if o == nil { - return nil - } - return o.Priority -} - -func (o *AlertsAlertEntity) GetIntegrationName() *string { - if o == nil { - return nil - } - return o.IntegrationName -} - -func (o *AlertsAlertEntity) GetStartsAt() *time.Time { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *AlertsAlertEntity) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *AlertsAlertEntity) GetDurationMs() *int { - if o == nil { - return nil - } - return o.DurationMs -} - -func (o *AlertsAlertEntity) GetDurationIso8601() *string { - if o == nil { - return nil - } - return o.DurationIso8601 -} - -func (o *AlertsAlertEntity) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *AlertsAlertEntity) GetRemoteID() *string { - if o == nil { - return nil - } - return o.RemoteID -} - -func (o *AlertsAlertEntity) GetRemoteURL() *string { - if o == nil { - return nil - } - return o.RemoteURL -} - -func (o *AlertsAlertEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *AlertsAlertEntity) GetEnvironments() []SuccinctEntity { - if o == nil { - return nil - } - return o.Environments -} - -func (o *AlertsAlertEntity) GetServices() []SuccinctEntity { - if o == nil { - return nil - } - return o.Services -} - -func (o *AlertsAlertEntity) GetTags() []string { - if o == nil { - return nil - } - return o.Tags -} - -func (o *AlertsAlertEntity) GetSourceIcon() *string { - if o == nil { - return nil - } - return o.SourceIcon -} - -func (o *AlertsAlertEntity) GetSignalID() *string { - if o == nil { - return nil - } - return o.SignalID -} - -func (o *AlertsAlertEntity) GetSignalRule() *SignalsAPIRuleEntity { - if o == nil { - return nil - } - return o.SignalRule -} - -func (o *AlertsAlertEntity) GetTeamName() *string { - if o == nil { - return nil - } - return o.TeamName -} - -func (o *AlertsAlertEntity) GetTeamID() *string { - if o == nil { - return nil - } - return o.TeamID -} - -func (o *AlertsAlertEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *AlertsAlertEntity) GetIncidents() []PublicAPIV1IncidentsSuccinctEntity { - if o == nil { - return nil - } - return o.Incidents -} - -func (o *AlertsAlertEntity) GetEvents() []AlertsSirenEventEntity { - if o == nil { - return nil - } - return o.Events -} - -func (o *AlertsAlertEntity) GetIsExpired() *bool { - if o == nil { - return nil - } - return o.IsExpired -} diff --git a/internal/sdk/models/shared/alertsalertentitypaginated.go b/internal/sdk/models/shared/alertsalertentitypaginated.go deleted file mode 100644 index 0b5aa88..0000000 --- a/internal/sdk/models/shared/alertsalertentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// AlertsAlertEntityPaginated - Alerts_AlertEntityPaginated model -type AlertsAlertEntityPaginated struct { - Data []AlertsAlertEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *AlertsAlertEntityPaginated) GetData() []AlertsAlertEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *AlertsAlertEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/alertsprocessinglogentryentity.go b/internal/sdk/models/shared/alertsprocessinglogentryentity.go deleted file mode 100644 index f28e2b6..0000000 --- a/internal/sdk/models/shared/alertsprocessinglogentryentity.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// Context - An unstructured representation of this log entry's context. -type Context struct { -} - -type Level string - -const ( - LevelUnknown Level = "unknown" - LevelDebug Level = "debug" - LevelInfo Level = "info" - LevelWarn Level = "warn" - LevelError Level = "error" - LevelFatal Level = "fatal" -) - -func (e Level) ToPointer() *Level { - return &e -} -func (e *Level) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "unknown": - fallthrough - case "debug": - fallthrough - case "info": - fallthrough - case "warn": - fallthrough - case "error": - fallthrough - case "fatal": - *e = Level(v) - return nil - default: - return fmt.Errorf("invalid value for Level: %v", v) - } -} - -type MessageType string - -const ( - MessageTypeI18nKey MessageType = "i18n_key" - MessageTypeCustom MessageType = "custom" -) - -func (e MessageType) ToPointer() *MessageType { - return &e -} -func (e *MessageType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "i18n_key": - fallthrough - case "custom": - *e = MessageType(v) - return nil - default: - return fmt.Errorf("invalid value for MessageType: %v", v) - } -} - -type AlertsProcessingLogEntryEntity struct { - ID *string `json:"id,omitempty"` - // An unstructured representation of this log entry's context. - Context *Context `json:"context,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - Level *Level `json:"level,omitempty"` - Message *string `json:"message,omitempty"` - MessageType *MessageType `json:"message_type,omitempty"` -} - -func (a AlertsProcessingLogEntryEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(a, "", false) -} - -func (a *AlertsProcessingLogEntryEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { - return err - } - return nil -} - -func (o *AlertsProcessingLogEntryEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *AlertsProcessingLogEntryEntity) GetContext() *Context { - if o == nil { - return nil - } - return o.Context -} - -func (o *AlertsProcessingLogEntryEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *AlertsProcessingLogEntryEntity) GetLevel() *Level { - if o == nil { - return nil - } - return o.Level -} - -func (o *AlertsProcessingLogEntryEntity) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *AlertsProcessingLogEntryEntity) GetMessageType() *MessageType { - if o == nil { - return nil - } - return o.MessageType -} diff --git a/internal/sdk/models/shared/alertsprocessinglogentryentitypaginated.go b/internal/sdk/models/shared/alertsprocessinglogentryentitypaginated.go deleted file mode 100644 index b50b2a3..0000000 --- a/internal/sdk/models/shared/alertsprocessinglogentryentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// AlertsProcessingLogEntryEntityPaginated - Alerts_ProcessingLogEntryEntityPaginated model -type AlertsProcessingLogEntryEntityPaginated struct { - Data []AlertsProcessingLogEntryEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *AlertsProcessingLogEntryEntityPaginated) GetData() []AlertsProcessingLogEntryEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *AlertsProcessingLogEntryEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/alertssirenevententity.go b/internal/sdk/models/shared/alertssirenevententity.go deleted file mode 100644 index bfc99cc..0000000 --- a/internal/sdk/models/shared/alertssirenevententity.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// AlertsSirenEventEntityData - The event's payload -type AlertsSirenEventEntityData struct { -} - -type AlertsSirenEventEntity struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - // The event's payload - Data *AlertsSirenEventEntityData `json:"data,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` -} - -func (a AlertsSirenEventEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(a, "", false) -} - -func (a *AlertsSirenEventEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { - return err - } - return nil -} - -func (o *AlertsSirenEventEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *AlertsSirenEventEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *AlertsSirenEventEntity) GetData() *AlertsSirenEventEntityData { - if o == nil { - return nil - } - return o.Data -} - -func (o *AlertsSirenEventEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} diff --git a/internal/sdk/models/shared/attachmentslinkentity.go b/internal/sdk/models/shared/attachmentslinkentity.go deleted file mode 100644 index b02b71a..0000000 --- a/internal/sdk/models/shared/attachmentslinkentity.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// AttachmentsLinkEntity - Attachments_LinkEntity model -type AttachmentsLinkEntity struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - DisplayText *string `json:"display_text,omitempty"` - HrefURL *string `json:"href_url,omitempty"` - IconURL *string `json:"icon_url,omitempty"` - // Link can be edited - Editable *bool `json:"editable,omitempty"` - // Link can be deleted - Deletable *bool `json:"deletable,omitempty"` -} - -func (o *AttachmentsLinkEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *AttachmentsLinkEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *AttachmentsLinkEntity) GetDisplayText() *string { - if o == nil { - return nil - } - return o.DisplayText -} - -func (o *AttachmentsLinkEntity) GetHrefURL() *string { - if o == nil { - return nil - } - return o.HrefURL -} - -func (o *AttachmentsLinkEntity) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -func (o *AttachmentsLinkEntity) GetEditable() *bool { - if o == nil { - return nil - } - return o.Editable -} - -func (o *AttachmentsLinkEntity) GetDeletable() *bool { - if o == nil { - return nil - } - return o.Deletable -} diff --git a/internal/sdk/models/shared/attachmentslinkentitypaginated.go b/internal/sdk/models/shared/attachmentslinkentitypaginated.go deleted file mode 100644 index 424f731..0000000 --- a/internal/sdk/models/shared/attachmentslinkentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// AttachmentsLinkEntityPaginated - Attachments_LinkEntityPaginated model -type AttachmentsLinkEntityPaginated struct { - Data []AttachmentsLinkEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *AttachmentsLinkEntityPaginated) GetData() []AttachmentsLinkEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *AttachmentsLinkEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/authorentity.go b/internal/sdk/models/shared/authorentity.go deleted file mode 100644 index fb74c5b..0000000 --- a/internal/sdk/models/shared/authorentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type AuthorEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Source *string `json:"source,omitempty"` - Email *string `json:"email,omitempty"` -} - -func (o *AuthorEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *AuthorEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *AuthorEntity) GetSource() *string { - if o == nil { - return nil - } - return o.Source -} - -func (o *AuthorEntity) GetEmail() *string { - if o == nil { - return nil - } - return o.Email -} diff --git a/internal/sdk/models/shared/calendarsevententity.go b/internal/sdk/models/shared/calendarsevententity.go deleted file mode 100644 index 095ce5a..0000000 --- a/internal/sdk/models/shared/calendarsevententity.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type CalendarsEventEntity struct { - ID *string `json:"id,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - StartsAt *string `json:"starts_at,omitempty"` - EndsAt *string `json:"ends_at,omitempty"` - CreatedAt *string `json:"created_at,omitempty"` - UpdatedAt *string `json:"updated_at,omitempty"` - ProviderURL *string `json:"provider_url,omitempty"` - ProviderIconURL *string `json:"provider_icon_url,omitempty"` -} - -func (o *CalendarsEventEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *CalendarsEventEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *CalendarsEventEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *CalendarsEventEntity) GetStartsAt() *string { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *CalendarsEventEntity) GetEndsAt() *string { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *CalendarsEventEntity) GetCreatedAt() *string { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *CalendarsEventEntity) GetUpdatedAt() *string { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *CalendarsEventEntity) GetProviderURL() *string { - if o == nil { - return nil - } - return o.ProviderURL -} - -func (o *CalendarsEventEntity) GetProviderIconURL() *string { - if o == nil { - return nil - } - return o.ProviderIconURL -} diff --git a/internal/sdk/models/shared/changeentity.go b/internal/sdk/models/shared/changeentity.go deleted file mode 100644 index 522d7d4..0000000 --- a/internal/sdk/models/shared/changeentity.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// ChangeEntity model -type ChangeEntity struct { - // UUID of the Change - ID *string `json:"id,omitempty"` - // Description of the Change - Summary *string `json:"summary,omitempty"` - // The time the change entry was created - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // Arbitrary key/value pairs of labels. - Labels map[string]string `json:"labels,omitempty"` - // Description of the Change - Description *string `json:"description,omitempty"` -} - -func (c ChangeEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(c, "", false) -} - -func (c *ChangeEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ChangeEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ChangeEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *ChangeEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ChangeEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ChangeEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *ChangeEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} diff --git a/internal/sdk/models/shared/changeevententity.go b/internal/sdk/models/shared/changeevententity.go deleted file mode 100644 index 4a547a9..0000000 --- a/internal/sdk/models/shared/changeevententity.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type ChangeEventEntityAttachments struct { -} - -// ChangeEventEntity model -type ChangeEventEntity struct { - ID *string `json:"id,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - ExternalID *string `json:"external_id,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - StartsAt *time.Time `json:"starts_at,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` - DurationMs *int `json:"duration_ms,omitempty"` - DurationIso8601 *string `json:"duration_iso8601,omitempty"` - Environments []EnvironmentEntryEntity `json:"environments,omitempty"` - RelatedChanges []ChangeEntity `json:"related_changes,omitempty"` - Identities []ChangeIdentityEntity `json:"identities,omitempty"` - Authors []AuthorEntity `json:"authors,omitempty"` - // A list of objects attached to this item. Can be one of: LinkEntity, CustomerSupportIssueEntity, or GenericAttachmentEntity - Attachments []ChangeEventEntityAttachments `json:"attachments,omitempty"` - // An object of label key and values - Labels map[string]string `json:"labels,omitempty"` - Services []ServiceEntity `json:"services,omitempty"` -} - -func (c ChangeEventEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(c, "", false) -} - -func (c *ChangeEventEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ChangeEventEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ChangeEventEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *ChangeEventEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *ChangeEventEntity) GetExternalID() *string { - if o == nil { - return nil - } - return o.ExternalID -} - -func (o *ChangeEventEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ChangeEventEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ChangeEventEntity) GetStartsAt() *time.Time { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *ChangeEventEntity) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *ChangeEventEntity) GetDurationMs() *int { - if o == nil { - return nil - } - return o.DurationMs -} - -func (o *ChangeEventEntity) GetDurationIso8601() *string { - if o == nil { - return nil - } - return o.DurationIso8601 -} - -func (o *ChangeEventEntity) GetEnvironments() []EnvironmentEntryEntity { - if o == nil { - return nil - } - return o.Environments -} - -func (o *ChangeEventEntity) GetRelatedChanges() []ChangeEntity { - if o == nil { - return nil - } - return o.RelatedChanges -} - -func (o *ChangeEventEntity) GetIdentities() []ChangeIdentityEntity { - if o == nil { - return nil - } - return o.Identities -} - -func (o *ChangeEventEntity) GetAuthors() []AuthorEntity { - if o == nil { - return nil - } - return o.Authors -} - -func (o *ChangeEventEntity) GetAttachments() []ChangeEventEntityAttachments { - if o == nil { - return nil - } - return o.Attachments -} - -func (o *ChangeEventEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *ChangeEventEntity) GetServices() []ServiceEntity { - if o == nil { - return nil - } - return o.Services -} diff --git a/internal/sdk/models/shared/changeeventslimentity.go b/internal/sdk/models/shared/changeeventslimentity.go deleted file mode 100644 index 7874416..0000000 --- a/internal/sdk/models/shared/changeeventslimentity.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type ChangeEventSlimEntity struct { - ID *string `json:"id,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - ExternalID *string `json:"external_id,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - StartsAt *time.Time `json:"starts_at,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` - DurationMs *int `json:"duration_ms,omitempty"` - DurationIso8601 *string `json:"duration_iso8601,omitempty"` - Environments []EnvironmentEntryEntity `json:"environments,omitempty"` - Authors []AuthorEntity `json:"authors,omitempty"` - // An object of label key and values - Labels map[string]string `json:"labels,omitempty"` - Services []ServiceEntity `json:"services,omitempty"` -} - -func (c ChangeEventSlimEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(c, "", false) -} - -func (c *ChangeEventSlimEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ChangeEventSlimEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ChangeEventSlimEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *ChangeEventSlimEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *ChangeEventSlimEntity) GetExternalID() *string { - if o == nil { - return nil - } - return o.ExternalID -} - -func (o *ChangeEventSlimEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ChangeEventSlimEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ChangeEventSlimEntity) GetStartsAt() *time.Time { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *ChangeEventSlimEntity) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *ChangeEventSlimEntity) GetDurationMs() *int { - if o == nil { - return nil - } - return o.DurationMs -} - -func (o *ChangeEventSlimEntity) GetDurationIso8601() *string { - if o == nil { - return nil - } - return o.DurationIso8601 -} - -func (o *ChangeEventSlimEntity) GetEnvironments() []EnvironmentEntryEntity { - if o == nil { - return nil - } - return o.Environments -} - -func (o *ChangeEventSlimEntity) GetAuthors() []AuthorEntity { - if o == nil { - return nil - } - return o.Authors -} - -func (o *ChangeEventSlimEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *ChangeEventSlimEntity) GetServices() []ServiceEntity { - if o == nil { - return nil - } - return o.Services -} diff --git a/internal/sdk/models/shared/changeeventslimentitypaginated.go b/internal/sdk/models/shared/changeeventslimentitypaginated.go deleted file mode 100644 index 390cf25..0000000 --- a/internal/sdk/models/shared/changeeventslimentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// ChangeEventSlimEntityPaginated model -type ChangeEventSlimEntityPaginated struct { - Data []ChangeEventSlimEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *ChangeEventSlimEntityPaginated) GetData() []ChangeEventSlimEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *ChangeEventSlimEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/changeidentityentity.go b/internal/sdk/models/shared/changeidentityentity.go deleted file mode 100644 index f1c1a24..0000000 --- a/internal/sdk/models/shared/changeidentityentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// ChangeIdentityEntity model -type ChangeIdentityEntity struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Value *string `json:"value,omitempty"` - ChangeID *string `json:"change_id,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (c ChangeIdentityEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(c, "", false) -} - -func (c *ChangeIdentityEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ChangeIdentityEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ChangeIdentityEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *ChangeIdentityEntity) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} - -func (o *ChangeIdentityEntity) GetChangeID() *string { - if o == nil { - return nil - } - return o.ChangeID -} - -func (o *ChangeIdentityEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ChangeIdentityEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} diff --git a/internal/sdk/models/shared/changeidentityentitypaginated.go b/internal/sdk/models/shared/changeidentityentitypaginated.go deleted file mode 100644 index 5dd9098..0000000 --- a/internal/sdk/models/shared/changeidentityentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// ChangeIdentityEntityPaginated model -type ChangeIdentityEntityPaginated struct { - Data []ChangeIdentityEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *ChangeIdentityEntityPaginated) GetData() []ChangeIdentityEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *ChangeIdentityEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/changetypeentity.go b/internal/sdk/models/shared/changetypeentity.go deleted file mode 100644 index 8303fa9..0000000 --- a/internal/sdk/models/shared/changetypeentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ChangeTypeEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` -} - -func (o *ChangeTypeEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ChangeTypeEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/changetypeentitypaginated.go b/internal/sdk/models/shared/changetypeentitypaginated.go deleted file mode 100644 index 834d52e..0000000 --- a/internal/sdk/models/shared/changetypeentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// ChangeTypeEntityPaginated model -type ChangeTypeEntityPaginated struct { - Data []ChangeTypeEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *ChangeTypeEntityPaginated) GetData() []ChangeTypeEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *ChangeTypeEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/checklistcheckentity.go b/internal/sdk/models/shared/checklistcheckentity.go deleted file mode 100644 index 6f77a23..0000000 --- a/internal/sdk/models/shared/checklistcheckentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ChecklistCheckEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Status *bool `json:"status,omitempty"` -} - -func (o *ChecklistCheckEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ChecklistCheckEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *ChecklistCheckEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *ChecklistCheckEntity) GetStatus() *bool { - if o == nil { - return nil - } - return o.Status -} diff --git a/internal/sdk/models/shared/checklisttemplateentity.go b/internal/sdk/models/shared/checklisttemplateentity.go deleted file mode 100644 index 8d2aaf3..0000000 --- a/internal/sdk/models/shared/checklisttemplateentity.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// ChecklistTemplateEntity model -type ChecklistTemplateEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CreatedAt *string `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - Checks []ChecklistCheckEntity `json:"checks,omitempty"` - // TeamEntity model - Owner *TeamEntity `json:"owner,omitempty"` - // List of services that use this checklist - ConnectedServices []ServiceEntity `json:"connected_services,omitempty"` -} - -func (c ChecklistTemplateEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(c, "", false) -} - -func (c *ChecklistTemplateEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ChecklistTemplateEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ChecklistTemplateEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *ChecklistTemplateEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *ChecklistTemplateEntity) GetCreatedAt() *string { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ChecklistTemplateEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ChecklistTemplateEntity) GetChecks() []ChecklistCheckEntity { - if o == nil { - return nil - } - return o.Checks -} - -func (o *ChecklistTemplateEntity) GetOwner() *TeamEntity { - if o == nil { - return nil - } - return o.Owner -} - -func (o *ChecklistTemplateEntity) GetConnectedServices() []ServiceEntity { - if o == nil { - return nil - } - return o.ConnectedServices -} diff --git a/internal/sdk/models/shared/checklisttemplateentitypaginated.go b/internal/sdk/models/shared/checklisttemplateentitypaginated.go deleted file mode 100644 index 10fbf62..0000000 --- a/internal/sdk/models/shared/checklisttemplateentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// ChecklistTemplateEntityPaginated model -type ChecklistTemplateEntityPaginated struct { - Data []ChecklistTemplateEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *ChecklistTemplateEntityPaginated) GetData() []ChecklistTemplateEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *ChecklistTemplateEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/conversationsapientitieschannel.go b/internal/sdk/models/shared/conversationsapientitieschannel.go deleted file mode 100644 index 7c425a9..0000000 --- a/internal/sdk/models/shared/conversationsapientitieschannel.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ConversationsAPIEntitiesChannel struct { - Name *string `json:"name,omitempty"` -} - -func (o *ConversationsAPIEntitiesChannel) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/conversationsapientitiesreference.go b/internal/sdk/models/shared/conversationsapientitiesreference.go deleted file mode 100644 index 9481802..0000000 --- a/internal/sdk/models/shared/conversationsapientitiesreference.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ConversationsAPIEntitiesReference struct { - ID *string `json:"id,omitempty"` - ResourceClass *string `json:"resource_class,omitempty"` - ResourceID *string `json:"resource_id,omitempty"` - Field *string `json:"field,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - Channel *ConversationsAPIEntitiesChannel `json:"channel,omitempty"` -} - -func (o *ConversationsAPIEntitiesReference) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ConversationsAPIEntitiesReference) GetResourceClass() *string { - if o == nil { - return nil - } - return o.ResourceClass -} - -func (o *ConversationsAPIEntitiesReference) GetResourceID() *string { - if o == nil { - return nil - } - return o.ResourceID -} - -func (o *ConversationsAPIEntitiesReference) GetField() *string { - if o == nil { - return nil - } - return o.Field -} - -func (o *ConversationsAPIEntitiesReference) GetCommentsURL() *string { - if o == nil { - return nil - } - return o.CommentsURL -} - -func (o *ConversationsAPIEntitiesReference) GetChannel() *ConversationsAPIEntitiesChannel { - if o == nil { - return nil - } - return o.Channel -} diff --git a/internal/sdk/models/shared/currentuserentity.go b/internal/sdk/models/shared/currentuserentity.go deleted file mode 100644 index 172b6c5..0000000 --- a/internal/sdk/models/shared/currentuserentity.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// CurrentUserEntity model -type CurrentUserEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Source *string `json:"source,omitempty"` - Email *string `json:"email,omitempty"` - Role *string `json:"role,omitempty"` - Teams []SuccinctEntity `json:"teams,omitempty"` - OrganizationID *string `json:"organization_id,omitempty"` - OrganizationName *string `json:"organization_name,omitempty"` - AccountID *int `json:"account_id,omitempty"` -} - -func (o *CurrentUserEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *CurrentUserEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *CurrentUserEntity) GetSource() *string { - if o == nil { - return nil - } - return o.Source -} - -func (o *CurrentUserEntity) GetEmail() *string { - if o == nil { - return nil - } - return o.Email -} - -func (o *CurrentUserEntity) GetRole() *string { - if o == nil { - return nil - } - return o.Role -} - -func (o *CurrentUserEntity) GetTeams() []SuccinctEntity { - if o == nil { - return nil - } - return o.Teams -} - -func (o *CurrentUserEntity) GetOrganizationID() *string { - if o == nil { - return nil - } - return o.OrganizationID -} - -func (o *CurrentUserEntity) GetOrganizationName() *string { - if o == nil { - return nil - } - return o.OrganizationName -} - -func (o *CurrentUserEntity) GetAccountID() *int { - if o == nil { - return nil - } - return o.AccountID -} diff --git a/internal/sdk/models/shared/customfieldsfieldvalue.go b/internal/sdk/models/shared/customfieldsfieldvalue.go deleted file mode 100644 index 9439081..0000000 --- a/internal/sdk/models/shared/customfieldsfieldvalue.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type CustomFieldsFieldValue struct { - Name *string `json:"name,omitempty"` - ValueType *string `json:"value_type,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - Description *string `json:"description,omitempty"` - Slug *string `json:"slug,omitempty"` - FieldID *string `json:"field_id,omitempty"` - ValueArray *string `json:"value_array,omitempty"` - ValueString *string `json:"value_string,omitempty"` - Value *string `json:"value,omitempty"` -} - -func (o *CustomFieldsFieldValue) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *CustomFieldsFieldValue) GetValueType() *string { - if o == nil { - return nil - } - return o.ValueType -} - -func (o *CustomFieldsFieldValue) GetDisplayName() *string { - if o == nil { - return nil - } - return o.DisplayName -} - -func (o *CustomFieldsFieldValue) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *CustomFieldsFieldValue) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *CustomFieldsFieldValue) GetFieldID() *string { - if o == nil { - return nil - } - return o.FieldID -} - -func (o *CustomFieldsFieldValue) GetValueArray() *string { - if o == nil { - return nil - } - return o.ValueArray -} - -func (o *CustomFieldsFieldValue) GetValueString() *string { - if o == nil { - return nil - } - return o.ValueString -} - -func (o *CustomFieldsFieldValue) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} diff --git a/internal/sdk/models/shared/entitlemententity.go b/internal/sdk/models/shared/entitlemententity.go deleted file mode 100644 index 600acc9..0000000 --- a/internal/sdk/models/shared/entitlemententity.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type Tier string - -const ( - TierFree Tier = "free" - TierEssentials Tier = "essentials" - TierEnterprise Tier = "enterprise" - TierSignalsOnly Tier = "signals_only" -) - -func (e Tier) ToPointer() *Tier { - return &e -} -func (e *Tier) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "free": - fallthrough - case "essentials": - fallthrough - case "enterprise": - fallthrough - case "signals_only": - *e = Tier(v) - return nil - default: - return fmt.Errorf("invalid value for Tier: %v", v) - } -} - -type EntitlementEntity struct { - CurrentCount *int `json:"current_count,omitempty"` - Errors []string `json:"errors,omitempty"` - Exists *bool `json:"exists,omitempty"` - Available *bool `json:"available,omitempty"` - Maximum *int `json:"maximum,omitempty"` - Name *string `json:"name,omitempty"` - Slug *string `json:"slug,omitempty"` - Tier *Tier `json:"tier,omitempty"` -} - -func (o *EntitlementEntity) GetCurrentCount() *int { - if o == nil { - return nil - } - return o.CurrentCount -} - -func (o *EntitlementEntity) GetErrors() []string { - if o == nil { - return nil - } - return o.Errors -} - -func (o *EntitlementEntity) GetExists() *bool { - if o == nil { - return nil - } - return o.Exists -} - -func (o *EntitlementEntity) GetAvailable() *bool { - if o == nil { - return nil - } - return o.Available -} - -func (o *EntitlementEntity) GetMaximum() *int { - if o == nil { - return nil - } - return o.Maximum -} - -func (o *EntitlementEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *EntitlementEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *EntitlementEntity) GetTier() *Tier { - if o == nil { - return nil - } - return o.Tier -} diff --git a/internal/sdk/models/shared/entitlemententitypaginated.go b/internal/sdk/models/shared/entitlemententitypaginated.go deleted file mode 100644 index 50d2bd2..0000000 --- a/internal/sdk/models/shared/entitlemententitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// EntitlementEntityPaginated model -type EntitlementEntityPaginated struct { - Data []EntitlementEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *EntitlementEntityPaginated) GetData() []EntitlementEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *EntitlementEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/environmententryentity.go b/internal/sdk/models/shared/environmententryentity.go deleted file mode 100644 index a1d1e89..0000000 --- a/internal/sdk/models/shared/environmententryentity.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// EnvironmentEntryEntity model -type EnvironmentEntryEntity struct { - // UUID of the Environment - ID *string `json:"id,omitempty"` - // Name of the Environment - Name *string `json:"name,omitempty"` - // Slug of the Environment - Slug *string `json:"slug,omitempty"` - // Description of the Environment - Description *string `json:"description,omitempty"` - // The time the environment was updated - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // The time the environment was created - CreatedAt *time.Time `json:"created_at,omitempty"` - // List of active incident guids - ActiveIncidents *string `json:"active_incidents,omitempty"` - // Information about known linkages to representations of services outside of FireHydrant. - ExternalResources []ExternalResourceEntity `json:"external_resources,omitempty"` -} - -func (e EnvironmentEntryEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(e, "", false) -} - -func (e *EnvironmentEntryEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &e, "", false, false); err != nil { - return err - } - return nil -} - -func (o *EnvironmentEntryEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *EnvironmentEntryEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *EnvironmentEntryEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *EnvironmentEntryEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *EnvironmentEntryEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *EnvironmentEntryEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *EnvironmentEntryEntity) GetActiveIncidents() *string { - if o == nil { - return nil - } - return o.ActiveIncidents -} - -func (o *EnvironmentEntryEntity) GetExternalResources() []ExternalResourceEntity { - if o == nil { - return nil - } - return o.ExternalResources -} diff --git a/internal/sdk/models/shared/environmententryentitypaginated.go b/internal/sdk/models/shared/environmententryentitypaginated.go deleted file mode 100644 index a6226f3..0000000 --- a/internal/sdk/models/shared/environmententryentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// EnvironmentEntryEntityPaginated model -type EnvironmentEntryEntityPaginated struct { - Data []EnvironmentEntryEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *EnvironmentEntryEntityPaginated) GetData() []EnvironmentEntryEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *EnvironmentEntryEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/errorentity.go b/internal/sdk/models/shared/errorentity.go deleted file mode 100644 index ffe0322..0000000 --- a/internal/sdk/models/shared/errorentity.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// Meta - An object with additional error metadata -type Meta struct { -} - -// ErrorEntity model -type ErrorEntity struct { - Detail *string `json:"detail,omitempty"` - Messages []string `json:"messages,omitempty"` - // An object with additional error metadata - Meta *Meta `json:"meta,omitempty"` - // A stable code on which to match errors - Code *string `json:"code,omitempty"` -} - -func (o *ErrorEntity) GetDetail() *string { - if o == nil { - return nil - } - return o.Detail -} - -func (o *ErrorEntity) GetMessages() []string { - if o == nil { - return nil - } - return o.Messages -} - -func (o *ErrorEntity) GetMeta() *Meta { - if o == nil { - return nil - } - return o.Meta -} - -func (o *ErrorEntity) GetCode() *string { - if o == nil { - return nil - } - return o.Code -} diff --git a/internal/sdk/models/shared/eventgenericchatmessageentity.go b/internal/sdk/models/shared/eventgenericchatmessageentity.go deleted file mode 100644 index 0aa7af2..0000000 --- a/internal/sdk/models/shared/eventgenericchatmessageentity.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// EventGenericChatMessageEntity - Event_GenericChatMessageEntity model -type EventGenericChatMessageEntity struct { - ID *string `json:"id,omitempty"` - Body *string `json:"body,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` -} - -func (e EventGenericChatMessageEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(e, "", false) -} - -func (e *EventGenericChatMessageEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &e, "", false, false); err != nil { - return err - } - return nil -} - -func (o *EventGenericChatMessageEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *EventGenericChatMessageEntity) GetBody() *string { - if o == nil { - return nil - } - return o.Body -} - -func (o *EventGenericChatMessageEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} diff --git a/internal/sdk/models/shared/eventnoteentity.go b/internal/sdk/models/shared/eventnoteentity.go deleted file mode 100644 index 70d8b37..0000000 --- a/internal/sdk/models/shared/eventnoteentity.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// EventNoteEntity - Event_NoteEntity model -type EventNoteEntity struct { - ID *string `json:"id,omitempty"` - Body *string `json:"body,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - StatusPages []IncidentsStatusPageEntity `json:"status_pages,omitempty"` - Conversations []ConversationsAPIEntitiesReference `json:"conversations,omitempty"` -} - -func (e EventNoteEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(e, "", false) -} - -func (e *EventNoteEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &e, "", false, false); err != nil { - return err - } - return nil -} - -func (o *EventNoteEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *EventNoteEntity) GetBody() *string { - if o == nil { - return nil - } - return o.Body -} - -func (o *EventNoteEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *EventNoteEntity) GetStatusPages() []IncidentsStatusPageEntity { - if o == nil { - return nil - } - return o.StatusPages -} - -func (o *EventNoteEntity) GetConversations() []ConversationsAPIEntitiesReference { - if o == nil { - return nil - } - return o.Conversations -} diff --git a/internal/sdk/models/shared/externalresourceentity.go b/internal/sdk/models/shared/externalresourceentity.go deleted file mode 100644 index 82e240b..0000000 --- a/internal/sdk/models/shared/externalresourceentity.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type ExternalResourceEntity struct { - ConnectionType *string `json:"connection_type,omitempty"` - ConnectionName *string `json:"connection_name,omitempty"` - ConnectionID *string `json:"connection_id,omitempty"` - RemoteID *string `json:"remote_id,omitempty"` - RemoteURL *string `json:"remote_url,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - Name *string `json:"name,omitempty"` -} - -func (e ExternalResourceEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(e, "", false) -} - -func (e *ExternalResourceEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &e, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ExternalResourceEntity) GetConnectionType() *string { - if o == nil { - return nil - } - return o.ConnectionType -} - -func (o *ExternalResourceEntity) GetConnectionName() *string { - if o == nil { - return nil - } - return o.ConnectionName -} - -func (o *ExternalResourceEntity) GetConnectionID() *string { - if o == nil { - return nil - } - return o.ConnectionID -} - -func (o *ExternalResourceEntity) GetRemoteID() *string { - if o == nil { - return nil - } - return o.RemoteID -} - -func (o *ExternalResourceEntity) GetRemoteURL() *string { - if o == nil { - return nil - } - return o.RemoteURL -} - -func (o *ExternalResourceEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ExternalResourceEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ExternalResourceEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/fhtypesgenericentity.go b/internal/sdk/models/shared/fhtypesgenericentity.go deleted file mode 100644 index b7bd5b0..0000000 --- a/internal/sdk/models/shared/fhtypesgenericentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type FHTypesGenericEntity struct { - Type *string `json:"type,omitempty"` - Value *string `json:"value,omitempty"` - Label *string `json:"label,omitempty"` -} - -func (o *FHTypesGenericEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *FHTypesGenericEntity) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} - -func (o *FHTypesGenericEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} diff --git a/internal/sdk/models/shared/fieldmappingfieldmapentity.go b/internal/sdk/models/shared/fieldmappingfieldmapentity.go deleted file mode 100644 index 0c9b883..0000000 --- a/internal/sdk/models/shared/fieldmappingfieldmapentity.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type Body struct { -} - -// FieldMappingFieldMapEntity - FieldMapping_FieldMapEntity model -type FieldMappingFieldMapEntity struct { - ID *string `json:"id,omitempty"` - ConnectionID *string `json:"connection_id,omitempty"` - ConnectionType *string `json:"connection_type,omitempty"` - EntityID *string `json:"entity_id,omitempty"` - EntityType *string `json:"entity_type,omitempty"` - Body *Body `json:"body,omitempty"` - AvailableFieldsURL *string `json:"available_fields_url,omitempty"` - DataBagURL *string `json:"data_bag_url,omitempty"` -} - -func (o *FieldMappingFieldMapEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *FieldMappingFieldMapEntity) GetConnectionID() *string { - if o == nil { - return nil - } - return o.ConnectionID -} - -func (o *FieldMappingFieldMapEntity) GetConnectionType() *string { - if o == nil { - return nil - } - return o.ConnectionType -} - -func (o *FieldMappingFieldMapEntity) GetEntityID() *string { - if o == nil { - return nil - } - return o.EntityID -} - -func (o *FieldMappingFieldMapEntity) GetEntityType() *string { - if o == nil { - return nil - } - return o.EntityType -} - -func (o *FieldMappingFieldMapEntity) GetBody() *Body { - if o == nil { - return nil - } - return o.Body -} - -func (o *FieldMappingFieldMapEntity) GetAvailableFieldsURL() *string { - if o == nil { - return nil - } - return o.AvailableFieldsURL -} - -func (o *FieldMappingFieldMapEntity) GetDataBagURL() *string { - if o == nil { - return nil - } - return o.DataBagURL -} diff --git a/internal/sdk/models/shared/fieldmappingmappablefieldentity.go b/internal/sdk/models/shared/fieldmappingmappablefieldentity.go deleted file mode 100644 index 8ec2f34..0000000 --- a/internal/sdk/models/shared/fieldmappingmappablefieldentity.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// FieldMappingMappableFieldEntity - FieldMapping_MappableFieldEntity model -type FieldMappingMappableFieldEntity struct { - // The ID of the field - Value *string `json:"value,omitempty"` - // The human-readable name of the field - Label *string `json:"label,omitempty"` - // The allowed type of the field - Type *string `json:"type,omitempty"` - // The allowed values of the field - AllowedValues *string `json:"allowed_values,omitempty"` - // If the field is required to be mapped - Required *string `json:"required,omitempty"` - // Short, inline documentation for the present field - HelpText *string `json:"help_text,omitempty"` -} - -func (o *FieldMappingMappableFieldEntity) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} - -func (o *FieldMappingMappableFieldEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} - -func (o *FieldMappingMappableFieldEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *FieldMappingMappableFieldEntity) GetAllowedValues() *string { - if o == nil { - return nil - } - return o.AllowedValues -} - -func (o *FieldMappingMappableFieldEntity) GetRequired() *string { - if o == nil { - return nil - } - return o.Required -} - -func (o *FieldMappingMappableFieldEntity) GetHelpText() *string { - if o == nil { - return nil - } - return o.HelpText -} diff --git a/internal/sdk/models/shared/functionalityentity.go b/internal/sdk/models/shared/functionalityentity.go deleted file mode 100644 index 630afa0..0000000 --- a/internal/sdk/models/shared/functionalityentity.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// FunctionalityEntity model -type FunctionalityEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Slug *string `json:"slug,omitempty"` - Description *string `json:"description,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // An object of label key and values - Labels map[string]string `json:"labels,omitempty"` - // List of active incident guids - ActiveIncidents []string `json:"active_incidents,omitempty"` - // List of links attached to this functionality. - Links []LinksEntity `json:"links,omitempty"` - // TeamEntity model - Owner *TeamEntity `json:"owner,omitempty"` - AlertOnAdd *bool `json:"alert_on_add,omitempty"` - AutoAddRespondingTeam *bool `json:"auto_add_responding_team,omitempty"` - UpdatedBy *AuthorEntity `json:"updated_by,omitempty"` - // Information about known linkages to representations of services outside of FireHydrant. - ExternalResources []ExternalResourceEntity `json:"external_resources,omitempty"` - // List of teams attached to the functionality - Teams []TeamEntity `json:"teams,omitempty"` -} - -func (f FunctionalityEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(f, "", false) -} - -func (f *FunctionalityEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &f, "", false, false); err != nil { - return err - } - return nil -} - -func (o *FunctionalityEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *FunctionalityEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *FunctionalityEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *FunctionalityEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *FunctionalityEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *FunctionalityEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *FunctionalityEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *FunctionalityEntity) GetActiveIncidents() []string { - if o == nil { - return nil - } - return o.ActiveIncidents -} - -func (o *FunctionalityEntity) GetLinks() []LinksEntity { - if o == nil { - return nil - } - return o.Links -} - -func (o *FunctionalityEntity) GetOwner() *TeamEntity { - if o == nil { - return nil - } - return o.Owner -} - -func (o *FunctionalityEntity) GetAlertOnAdd() *bool { - if o == nil { - return nil - } - return o.AlertOnAdd -} - -func (o *FunctionalityEntity) GetAutoAddRespondingTeam() *bool { - if o == nil { - return nil - } - return o.AutoAddRespondingTeam -} - -func (o *FunctionalityEntity) GetUpdatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.UpdatedBy -} - -func (o *FunctionalityEntity) GetExternalResources() []ExternalResourceEntity { - if o == nil { - return nil - } - return o.ExternalResources -} - -func (o *FunctionalityEntity) GetTeams() []TeamEntity { - if o == nil { - return nil - } - return o.Teams -} diff --git a/internal/sdk/models/shared/functionalityentitypaginated.go b/internal/sdk/models/shared/functionalityentitypaginated.go deleted file mode 100644 index df04c87..0000000 --- a/internal/sdk/models/shared/functionalityentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// FunctionalityEntityPaginated model -type FunctionalityEntityPaginated struct { - Data []FunctionalityEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *FunctionalityEntityPaginated) GetData() []FunctionalityEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *FunctionalityEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/getv1metricsticketfunnel.go b/internal/sdk/models/shared/getv1metricsticketfunnel.go deleted file mode 100644 index cae07fc..0000000 --- a/internal/sdk/models/shared/getv1metricsticketfunnel.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type GroupBy string - -const ( - GroupByStartedDay GroupBy = "started_day" - GroupByStartedWeek GroupBy = "started_week" - GroupByStartedMonth GroupBy = "started_month" - GroupByAllTime GroupBy = "all_time" -) - -func (e GroupBy) ToPointer() *GroupBy { - return &e -} -func (e *GroupBy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "started_day": - fallthrough - case "started_week": - fallthrough - case "started_month": - fallthrough - case "all_time": - *e = GroupBy(v) - return nil - default: - return fmt.Errorf("invalid value for GroupBy: %v", v) - } -} - -type GetV1MetricsTicketFunnel struct { - GroupBy []GroupBy `form:"name=group_by"` -} - -func (o *GetV1MetricsTicketFunnel) GetGroupBy() []GroupBy { - if o == nil { - return nil - } - return o.GroupBy -} diff --git a/internal/sdk/models/shared/importsimportableresourceentity.go b/internal/sdk/models/shared/importsimportableresourceentity.go deleted file mode 100644 index 44aaf1e..0000000 --- a/internal/sdk/models/shared/importsimportableresourceentity.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type State string - -const ( - StateSelected State = "selected" - StateSkipped State = "skipped" - StateImported State = "imported" - StateErrored State = "errored" -) - -func (e State) ToPointer() *State { - return &e -} -func (e *State) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "selected": - fallthrough - case "skipped": - fallthrough - case "imported": - fallthrough - case "errored": - *e = State(v) - return nil - default: - return fmt.Errorf("invalid value for State: %v", v) - } -} - -type ImportsImportableResourceEntity struct { - ImportErrors []ImportsImportErrorEntity `json:"import_errors,omitempty"` - ImportedAt *time.Time `json:"imported_at,omitempty"` - RemoteID *string `json:"remote_id,omitempty"` - State *State `json:"state,omitempty"` -} - -func (i ImportsImportableResourceEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *ImportsImportableResourceEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ImportsImportableResourceEntity) GetImportErrors() []ImportsImportErrorEntity { - if o == nil { - return nil - } - return o.ImportErrors -} - -func (o *ImportsImportableResourceEntity) GetImportedAt() *time.Time { - if o == nil { - return nil - } - return o.ImportedAt -} - -func (o *ImportsImportableResourceEntity) GetRemoteID() *string { - if o == nil { - return nil - } - return o.RemoteID -} - -func (o *ImportsImportableResourceEntity) GetState() *State { - if o == nil { - return nil - } - return o.State -} diff --git a/internal/sdk/models/shared/importsimportentity.go b/internal/sdk/models/shared/importsimportentity.go deleted file mode 100644 index aa61beb..0000000 --- a/internal/sdk/models/shared/importsimportentity.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type ImportsImportEntityState string - -const ( - ImportsImportEntityStatePreprocessing ImportsImportEntityState = "preprocessing" - ImportsImportEntityStateReadyForImport ImportsImportEntityState = "ready_for_import" - ImportsImportEntityStateImporting ImportsImportEntityState = "importing" - ImportsImportEntityStateCompleted ImportsImportEntityState = "completed" -) - -func (e ImportsImportEntityState) ToPointer() *ImportsImportEntityState { - return &e -} -func (e *ImportsImportEntityState) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "preprocessing": - fallthrough - case "ready_for_import": - fallthrough - case "importing": - fallthrough - case "completed": - *e = ImportsImportEntityState(v) - return nil - default: - return fmt.Errorf("invalid value for ImportsImportEntityState: %v", v) - } -} - -// ImportsImportEntity - Imports_ImportEntity model -type ImportsImportEntity struct { - State *ImportsImportEntityState `json:"state,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (i ImportsImportEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *ImportsImportEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ImportsImportEntity) GetState() *ImportsImportEntityState { - if o == nil { - return nil - } - return o.State -} - -func (o *ImportsImportEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} diff --git a/internal/sdk/models/shared/importsimporterrorentity.go b/internal/sdk/models/shared/importsimporterrorentity.go deleted file mode 100644 index 36f73e3..0000000 --- a/internal/sdk/models/shared/importsimporterrorentity.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// Data - Additional error data -type Data struct { -} - -type ImportsImportErrorEntity struct { - ID *string `json:"id,omitempty"` - Message *string `json:"message,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - // Additional error data - Data *Data `json:"data,omitempty"` - Resource *ImportsImportErrorEntityResourceEntity `json:"resource,omitempty"` -} - -func (i ImportsImportErrorEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *ImportsImportErrorEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ImportsImportErrorEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ImportsImportErrorEntity) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *ImportsImportErrorEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ImportsImportErrorEntity) GetData() *Data { - if o == nil { - return nil - } - return o.Data -} - -func (o *ImportsImportErrorEntity) GetResource() *ImportsImportErrorEntityResourceEntity { - if o == nil { - return nil - } - return o.Resource -} diff --git a/internal/sdk/models/shared/importsimporterrorentityresourceentity.go b/internal/sdk/models/shared/importsimporterrorentityresourceentity.go deleted file mode 100644 index 327b712..0000000 --- a/internal/sdk/models/shared/importsimporterrorentityresourceentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ImportsImportErrorEntityResourceEntity struct { - ResourceID *string `json:"resource_id,omitempty"` - ResourceType *string `json:"resource_type,omitempty"` - Name *string `json:"name,omitempty"` -} - -func (o *ImportsImportErrorEntityResourceEntity) GetResourceID() *string { - if o == nil { - return nil - } - return o.ResourceID -} - -func (o *ImportsImportErrorEntityResourceEntity) GetResourceType() *string { - if o == nil { - return nil - } - return o.ResourceType -} - -func (o *ImportsImportErrorEntityResourceEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/incidentattachmententity.go b/internal/sdk/models/shared/incidentattachmententity.go deleted file mode 100644 index 4eb2b0b..0000000 --- a/internal/sdk/models/shared/incidentattachmententity.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type IncidentAttachmentEntityStatus string - -const ( - IncidentAttachmentEntityStatusPendingUpload IncidentAttachmentEntityStatus = "pending_upload" - IncidentAttachmentEntityStatusUploaded IncidentAttachmentEntityStatus = "uploaded" -) - -func (e IncidentAttachmentEntityStatus) ToPointer() *IncidentAttachmentEntityStatus { - return &e -} -func (e *IncidentAttachmentEntityStatus) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "pending_upload": - fallthrough - case "uploaded": - *e = IncidentAttachmentEntityStatus(v) - return nil - default: - return fmt.Errorf("invalid value for IncidentAttachmentEntityStatus: %v", v) - } -} - -// Versions - An object with keys that designate a specific version or size of the attachment -type Versions struct { -} - -// IncidentAttachmentEntity model -type IncidentAttachmentEntity struct { - FileName *string `json:"file_name,omitempty"` - FileContentType *string `json:"file_content_type,omitempty"` - SignedURL *string `json:"signed_url,omitempty"` - MediaType *string `json:"media_type,omitempty"` - Description *string `json:"description,omitempty"` - ExternalID *string `json:"external_id,omitempty"` - FileSize *int `json:"file_size,omitempty"` - Status *IncidentAttachmentEntityStatus `json:"status,omitempty"` - // An object with keys that designate a specific version or size of the attachment - Versions *Versions `json:"versions,omitempty"` -} - -func (o *IncidentAttachmentEntity) GetFileName() *string { - if o == nil { - return nil - } - return o.FileName -} - -func (o *IncidentAttachmentEntity) GetFileContentType() *string { - if o == nil { - return nil - } - return o.FileContentType -} - -func (o *IncidentAttachmentEntity) GetSignedURL() *string { - if o == nil { - return nil - } - return o.SignedURL -} - -func (o *IncidentAttachmentEntity) GetMediaType() *string { - if o == nil { - return nil - } - return o.MediaType -} - -func (o *IncidentAttachmentEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *IncidentAttachmentEntity) GetExternalID() *string { - if o == nil { - return nil - } - return o.ExternalID -} - -func (o *IncidentAttachmentEntity) GetFileSize() *int { - if o == nil { - return nil - } - return o.FileSize -} - -func (o *IncidentAttachmentEntity) GetStatus() *IncidentAttachmentEntityStatus { - if o == nil { - return nil - } - return o.Status -} - -func (o *IncidentAttachmentEntity) GetVersions() *Versions { - if o == nil { - return nil - } - return o.Versions -} diff --git a/internal/sdk/models/shared/incidententity.go b/internal/sdk/models/shared/incidententity.go deleted file mode 100644 index a5ca332..0000000 --- a/internal/sdk/models/shared/incidententity.go +++ /dev/null @@ -1,489 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type RetroExports struct { -} - -// IncidentEntity model -type IncidentEntity struct { - // UUID of the Incident - ID *string `json:"id,omitempty"` - // Name of the incident - Name *string `json:"name,omitempty"` - // The time the incident was opened - CreatedAt *time.Time `json:"created_at,omitempty"` - // The time the incident started - StartedAt *time.Time `json:"started_at,omitempty"` - // The time the incident was archived - DiscardedAt *time.Time `json:"discarded_at,omitempty"` - Summary *string `json:"summary,omitempty"` - CustomerImpactSummary *string `json:"customer_impact_summary,omitempty"` - Description *string `json:"description,omitempty"` - // The type/slug of the current milestone. Will be one of the currently configured milestones for the given incident. - CurrentMilestone *string `json:"current_milestone,omitempty"` - // Incident number - Number *int `json:"number,omitempty"` - Priority *string `json:"priority,omitempty"` - Severity *string `json:"severity,omitempty"` - SeverityColor *string `json:"severity_color,omitempty"` - SeverityImpact *string `json:"severity_impact,omitempty"` - SeverityCondition *string `json:"severity_condition,omitempty"` - TagList []string `json:"tag_list,omitempty"` - // SeverityMatrix_ImpactEntity model - SeverityImpactObject *SeverityMatrixImpactEntity `json:"severity_impact_object,omitempty"` - // SeverityMatrix_ConditionEntity model - SeverityConditionObject *SeverityMatrixConditionEntity `json:"severity_condition_object,omitempty"` - PrivateID *string `json:"private_id,omitempty"` - OrganizationID *string `json:"organization_id,omitempty"` - // DEPRECATED: Please use lifecycle phases instead - Milestones []IncidentsMilestoneEntity `json:"milestones,omitempty"` - LifecyclePhases []IncidentsLifecyclePhaseEntity `json:"lifecycle_phases,omitempty"` - LifecycleMeasurements []IncidentsLifecycleMeasurementEntity `json:"lifecycle_measurements,omitempty"` - Active *bool `json:"active,omitempty"` - // A key/value of labels - Labels map[string]string `json:"labels,omitempty"` - RoleAssignments []IncidentsRoleAssignmentEntity `json:"role_assignments,omitempty"` - StatusPages []IncidentsStatusPageEntity `json:"status_pages,omitempty"` - IncidentURL *string `json:"incident_url,omitempty"` - PrivateStatusPageURL *string `json:"private_status_page_url,omitempty"` - Organization *OrganizationEntity `json:"organization,omitempty"` - CustomersImpacted *int `json:"customers_impacted,omitempty"` - MonetaryImpact *int `json:"monetary_impact,omitempty"` - MonetaryImpactCents *int `json:"monetary_impact_cents,omitempty"` - LastUpdate *string `json:"last_update,omitempty"` - // Event_NoteEntity model - LastNote *EventNoteEntity `json:"last_note,omitempty"` - ReportID *string `json:"report_id,omitempty"` - AiIncidentSummary *string `json:"ai_incident_summary,omitempty"` - Services []SuccinctEntity `json:"services,omitempty"` - Environments []SuccinctEntity `json:"environments,omitempty"` - Functionalities []SuccinctEntity `json:"functionalities,omitempty"` - ChannelName *string `json:"channel_name,omitempty"` - ChannelReference *string `json:"channel_reference,omitempty"` - ChannelID *string `json:"channel_id,omitempty"` - // inoperative: 0, operational: 1, archived: 2 - ChannelStatus *string `json:"channel_status,omitempty"` - IncidentTickets []TicketingTicketEntity `json:"incident_tickets,omitempty"` - // Ticketing_TicketEntity model - Ticket *TicketingTicketEntity `json:"ticket,omitempty"` - Impacts []IncidentsImpactEntity `json:"impacts,omitempty"` - ConferenceBridges []IncidentsConferenceBridgeEntity `json:"conference_bridges,omitempty"` - IncidentChannels []IncidentsChannelEntity `json:"incident_channels,omitempty"` - // A list of objects attached to this item. Can be one of: LinkEntity, CustomerSupportIssueEntity, or GenericAttachmentEntity - RetroExports []RetroExports `json:"retro_exports,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - ContextObject *IncidentsContextObjectEntity `json:"context_object,omitempty"` - TeamAssignments []IncidentsTeamAssignmentEntity `json:"team_assignments,omitempty"` - Conversations []ConversationsAPIEntitiesReference `json:"conversations,omitempty"` - CustomFields []CustomFieldsFieldValue `json:"custom_fields,omitempty"` - FieldRequirements []IncidentEntityFieldRequirementEntity `json:"field_requirements,omitempty"` -} - -func (i IncidentEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IncidentEntity) GetStartedAt() *time.Time { - if o == nil { - return nil - } - return o.StartedAt -} - -func (o *IncidentEntity) GetDiscardedAt() *time.Time { - if o == nil { - return nil - } - return o.DiscardedAt -} - -func (o *IncidentEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *IncidentEntity) GetCustomerImpactSummary() *string { - if o == nil { - return nil - } - return o.CustomerImpactSummary -} - -func (o *IncidentEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *IncidentEntity) GetCurrentMilestone() *string { - if o == nil { - return nil - } - return o.CurrentMilestone -} - -func (o *IncidentEntity) GetNumber() *int { - if o == nil { - return nil - } - return o.Number -} - -func (o *IncidentEntity) GetPriority() *string { - if o == nil { - return nil - } - return o.Priority -} - -func (o *IncidentEntity) GetSeverity() *string { - if o == nil { - return nil - } - return o.Severity -} - -func (o *IncidentEntity) GetSeverityColor() *string { - if o == nil { - return nil - } - return o.SeverityColor -} - -func (o *IncidentEntity) GetSeverityImpact() *string { - if o == nil { - return nil - } - return o.SeverityImpact -} - -func (o *IncidentEntity) GetSeverityCondition() *string { - if o == nil { - return nil - } - return o.SeverityCondition -} - -func (o *IncidentEntity) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} - -func (o *IncidentEntity) GetSeverityImpactObject() *SeverityMatrixImpactEntity { - if o == nil { - return nil - } - return o.SeverityImpactObject -} - -func (o *IncidentEntity) GetSeverityConditionObject() *SeverityMatrixConditionEntity { - if o == nil { - return nil - } - return o.SeverityConditionObject -} - -func (o *IncidentEntity) GetPrivateID() *string { - if o == nil { - return nil - } - return o.PrivateID -} - -func (o *IncidentEntity) GetOrganizationID() *string { - if o == nil { - return nil - } - return o.OrganizationID -} - -func (o *IncidentEntity) GetMilestones() []IncidentsMilestoneEntity { - if o == nil { - return nil - } - return o.Milestones -} - -func (o *IncidentEntity) GetLifecyclePhases() []IncidentsLifecyclePhaseEntity { - if o == nil { - return nil - } - return o.LifecyclePhases -} - -func (o *IncidentEntity) GetLifecycleMeasurements() []IncidentsLifecycleMeasurementEntity { - if o == nil { - return nil - } - return o.LifecycleMeasurements -} - -func (o *IncidentEntity) GetActive() *bool { - if o == nil { - return nil - } - return o.Active -} - -func (o *IncidentEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *IncidentEntity) GetRoleAssignments() []IncidentsRoleAssignmentEntity { - if o == nil { - return nil - } - return o.RoleAssignments -} - -func (o *IncidentEntity) GetStatusPages() []IncidentsStatusPageEntity { - if o == nil { - return nil - } - return o.StatusPages -} - -func (o *IncidentEntity) GetIncidentURL() *string { - if o == nil { - return nil - } - return o.IncidentURL -} - -func (o *IncidentEntity) GetPrivateStatusPageURL() *string { - if o == nil { - return nil - } - return o.PrivateStatusPageURL -} - -func (o *IncidentEntity) GetOrganization() *OrganizationEntity { - if o == nil { - return nil - } - return o.Organization -} - -func (o *IncidentEntity) GetCustomersImpacted() *int { - if o == nil { - return nil - } - return o.CustomersImpacted -} - -func (o *IncidentEntity) GetMonetaryImpact() *int { - if o == nil { - return nil - } - return o.MonetaryImpact -} - -func (o *IncidentEntity) GetMonetaryImpactCents() *int { - if o == nil { - return nil - } - return o.MonetaryImpactCents -} - -func (o *IncidentEntity) GetLastUpdate() *string { - if o == nil { - return nil - } - return o.LastUpdate -} - -func (o *IncidentEntity) GetLastNote() *EventNoteEntity { - if o == nil { - return nil - } - return o.LastNote -} - -func (o *IncidentEntity) GetReportID() *string { - if o == nil { - return nil - } - return o.ReportID -} - -func (o *IncidentEntity) GetAiIncidentSummary() *string { - if o == nil { - return nil - } - return o.AiIncidentSummary -} - -func (o *IncidentEntity) GetServices() []SuccinctEntity { - if o == nil { - return nil - } - return o.Services -} - -func (o *IncidentEntity) GetEnvironments() []SuccinctEntity { - if o == nil { - return nil - } - return o.Environments -} - -func (o *IncidentEntity) GetFunctionalities() []SuccinctEntity { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *IncidentEntity) GetChannelName() *string { - if o == nil { - return nil - } - return o.ChannelName -} - -func (o *IncidentEntity) GetChannelReference() *string { - if o == nil { - return nil - } - return o.ChannelReference -} - -func (o *IncidentEntity) GetChannelID() *string { - if o == nil { - return nil - } - return o.ChannelID -} - -func (o *IncidentEntity) GetChannelStatus() *string { - if o == nil { - return nil - } - return o.ChannelStatus -} - -func (o *IncidentEntity) GetIncidentTickets() []TicketingTicketEntity { - if o == nil { - return nil - } - return o.IncidentTickets -} - -func (o *IncidentEntity) GetTicket() *TicketingTicketEntity { - if o == nil { - return nil - } - return o.Ticket -} - -func (o *IncidentEntity) GetImpacts() []IncidentsImpactEntity { - if o == nil { - return nil - } - return o.Impacts -} - -func (o *IncidentEntity) GetConferenceBridges() []IncidentsConferenceBridgeEntity { - if o == nil { - return nil - } - return o.ConferenceBridges -} - -func (o *IncidentEntity) GetIncidentChannels() []IncidentsChannelEntity { - if o == nil { - return nil - } - return o.IncidentChannels -} - -func (o *IncidentEntity) GetRetroExports() []RetroExports { - if o == nil { - return nil - } - return o.RetroExports -} - -func (o *IncidentEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *IncidentEntity) GetContextObject() *IncidentsContextObjectEntity { - if o == nil { - return nil - } - return o.ContextObject -} - -func (o *IncidentEntity) GetTeamAssignments() []IncidentsTeamAssignmentEntity { - if o == nil { - return nil - } - return o.TeamAssignments -} - -func (o *IncidentEntity) GetConversations() []ConversationsAPIEntitiesReference { - if o == nil { - return nil - } - return o.Conversations -} - -func (o *IncidentEntity) GetCustomFields() []CustomFieldsFieldValue { - if o == nil { - return nil - } - return o.CustomFields -} - -func (o *IncidentEntity) GetFieldRequirements() []IncidentEntityFieldRequirementEntity { - if o == nil { - return nil - } - return o.FieldRequirements -} diff --git a/internal/sdk/models/shared/incidententityfieldrequiremententity.go b/internal/sdk/models/shared/incidententityfieldrequiremententity.go deleted file mode 100644 index 1443e09..0000000 --- a/internal/sdk/models/shared/incidententityfieldrequiremententity.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IncidentEntityFieldRequirementEntity struct { - // A unique identifier for the field. - FieldID *string `json:"field_id,omitempty"` - // The milestone at which this field is required. If null, this field is always required. - RequiredAtMilestoneID *string `json:"required_at_milestone_id,omitempty"` -} - -func (o *IncidentEntityFieldRequirementEntity) GetFieldID() *string { - if o == nil { - return nil - } - return o.FieldID -} - -func (o *IncidentEntityFieldRequirementEntity) GetRequiredAtMilestoneID() *string { - if o == nil { - return nil - } - return o.RequiredAtMilestoneID -} diff --git a/internal/sdk/models/shared/incidententitypaginated.go b/internal/sdk/models/shared/incidententitypaginated.go deleted file mode 100644 index 51648ac..0000000 --- a/internal/sdk/models/shared/incidententitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentEntityPaginated model -type IncidentEntityPaginated struct { - Data []IncidentEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentEntityPaginated) GetData() []IncidentEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentevententity.go b/internal/sdk/models/shared/incidentevententity.go deleted file mode 100644 index 1574ef4..0000000 --- a/internal/sdk/models/shared/incidentevententity.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// IncidentEventEntityData - Can be one of: NoteEntity, TourStepEntity, RootCauseEntity, ChangeTypeEntity, RoleUpdateEntity, TaskUpdateEntity, AlertLinkedEntity, ChatMessageEntity, AddTaskListEntity, ImpactUpdateEntity, TicketUpdateEntity, GeneralUpdateEntity, ChangelogEntryEntity, IncidentStatusEntity, TeamAssignmentEntity, BulkUpdateEntity -type IncidentEventEntityData struct { -} - -type Visibility string - -const ( - VisibilityPrivateToOrg Visibility = "private_to_org" - VisibilityOpenToPublic Visibility = "open_to_public" - VisibilityInternalStatusPage Visibility = "internal_status_page" -) - -func (e Visibility) ToPointer() *Visibility { - return &e -} -func (e *Visibility) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "private_to_org": - fallthrough - case "open_to_public": - fallthrough - case "internal_status_page": - *e = Visibility(v) - return nil - default: - return fmt.Errorf("invalid value for Visibility: %v", v) - } -} - -// IncidentEventEntity model -type IncidentEventEntity struct { - ID *string `json:"id,omitempty"` - IncidentID *string `json:"incident_id,omitempty"` - Type *string `json:"type,omitempty"` - Context *string `json:"context,omitempty"` - // Can be one of: NoteEntity, TourStepEntity, RootCauseEntity, ChangeTypeEntity, RoleUpdateEntity, TaskUpdateEntity, AlertLinkedEntity, ChatMessageEntity, AddTaskListEntity, ImpactUpdateEntity, TicketUpdateEntity, GeneralUpdateEntity, ChangelogEntryEntity, IncidentStatusEntity, TeamAssignmentEntity, BulkUpdateEntity - Data *IncidentEventEntityData `json:"data,omitempty"` - OccurredAt *time.Time `json:"occurred_at,omitempty"` - Visibility *Visibility `json:"visibility,omitempty"` - Author *AuthorEntity `json:"author,omitempty"` - // VotesEntity model - Votes *VotesEntity `json:"votes,omitempty"` - Conversations []ConversationsAPIEntitiesReference `json:"conversations,omitempty"` -} - -func (i IncidentEventEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentEventEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentEventEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentEventEntity) GetIncidentID() *string { - if o == nil { - return nil - } - return o.IncidentID -} - -func (o *IncidentEventEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *IncidentEventEntity) GetContext() *string { - if o == nil { - return nil - } - return o.Context -} - -func (o *IncidentEventEntity) GetData() *IncidentEventEntityData { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentEventEntity) GetOccurredAt() *time.Time { - if o == nil { - return nil - } - return o.OccurredAt -} - -func (o *IncidentEventEntity) GetVisibility() *Visibility { - if o == nil { - return nil - } - return o.Visibility -} - -func (o *IncidentEventEntity) GetAuthor() *AuthorEntity { - if o == nil { - return nil - } - return o.Author -} - -func (o *IncidentEventEntity) GetVotes() *VotesEntity { - if o == nil { - return nil - } - return o.Votes -} - -func (o *IncidentEventEntity) GetConversations() []ConversationsAPIEntitiesReference { - if o == nil { - return nil - } - return o.Conversations -} diff --git a/internal/sdk/models/shared/incidentevententitypaginated.go b/internal/sdk/models/shared/incidentevententitypaginated.go deleted file mode 100644 index 2f43cda..0000000 --- a/internal/sdk/models/shared/incidentevententitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentEventEntityPaginated model -type IncidentEventEntityPaginated struct { - Data []IncidentEventEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentEventEntityPaginated) GetData() []IncidentEventEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentEventEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentimpactentity.go b/internal/sdk/models/shared/incidentimpactentity.go deleted file mode 100644 index 838c8d2..0000000 --- a/internal/sdk/models/shared/incidentimpactentity.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentImpactEntity model -type IncidentImpactEntity struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Infrastructure *SuccinctEntity `json:"infrastructure,omitempty"` -} - -func (o *IncidentImpactEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentImpactEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *IncidentImpactEntity) GetInfrastructure() *SuccinctEntity { - if o == nil { - return nil - } - return o.Infrastructure -} diff --git a/internal/sdk/models/shared/incidentimpactentitypaginated.go b/internal/sdk/models/shared/incidentimpactentitypaginated.go deleted file mode 100644 index 0691526..0000000 --- a/internal/sdk/models/shared/incidentimpactentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentImpactEntityPaginated model -type IncidentImpactEntityPaginated struct { - Data []IncidentImpactEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentImpactEntityPaginated) GetData() []IncidentImpactEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentImpactEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentroleentity.go b/internal/sdk/models/shared/incidentroleentity.go deleted file mode 100644 index da1c331..0000000 --- a/internal/sdk/models/shared/incidentroleentity.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// IncidentRoleEntity model -type IncidentRoleEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - DiscardedAt *time.Time `json:"discarded_at,omitempty"` -} - -func (i IncidentRoleEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentRoleEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentRoleEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentRoleEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentRoleEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *IncidentRoleEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *IncidentRoleEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IncidentRoleEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *IncidentRoleEntity) GetDiscardedAt() *time.Time { - if o == nil { - return nil - } - return o.DiscardedAt -} diff --git a/internal/sdk/models/shared/incidentroleentitypaginated.go b/internal/sdk/models/shared/incidentroleentitypaginated.go deleted file mode 100644 index 180ab90..0000000 --- a/internal/sdk/models/shared/incidentroleentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentRoleEntityPaginated model -type IncidentRoleEntityPaginated struct { - Data []IncidentRoleEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentRoleEntityPaginated) GetData() []IncidentRoleEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentRoleEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentsalertentity.go b/internal/sdk/models/shared/incidentsalertentity.go deleted file mode 100644 index 4db08e0..0000000 --- a/internal/sdk/models/shared/incidentsalertentity.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsAlertEntity - Incidents_AlertEntity model -type IncidentsAlertEntity struct { - ID *string `json:"id,omitempty"` - // Alerts_AlertEntity model - Alert *AlertsAlertEntity `json:"alert,omitempty"` - // whether or not this is the primary alert for this incident - Primary *bool `json:"primary,omitempty"` -} - -func (o *IncidentsAlertEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsAlertEntity) GetAlert() *AlertsAlertEntity { - if o == nil { - return nil - } - return o.Alert -} - -func (o *IncidentsAlertEntity) GetPrimary() *bool { - if o == nil { - return nil - } - return o.Primary -} diff --git a/internal/sdk/models/shared/incidentsalertentitypaginated.go b/internal/sdk/models/shared/incidentsalertentitypaginated.go deleted file mode 100644 index 3b6bd6a..0000000 --- a/internal/sdk/models/shared/incidentsalertentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsAlertEntityPaginated - Incidents_AlertEntityPaginated model -type IncidentsAlertEntityPaginated struct { - Data []IncidentsAlertEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentsAlertEntityPaginated) GetData() []IncidentsAlertEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentsAlertEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentschannelentity.go b/internal/sdk/models/shared/incidentschannelentity.go deleted file mode 100644 index aac0248..0000000 --- a/internal/sdk/models/shared/incidentschannelentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsChannelEntity - Incidents_ChannelEntity model -type IncidentsChannelEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Source *string `json:"source,omitempty"` - SourceName *string `json:"source_name,omitempty"` - SourceID *string `json:"source_id,omitempty"` - URL *string `json:"url,omitempty"` - IconURL *string `json:"icon_url,omitempty"` - Status *string `json:"status,omitempty"` -} - -func (o *IncidentsChannelEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsChannelEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentsChannelEntity) GetSource() *string { - if o == nil { - return nil - } - return o.Source -} - -func (o *IncidentsChannelEntity) GetSourceName() *string { - if o == nil { - return nil - } - return o.SourceName -} - -func (o *IncidentsChannelEntity) GetSourceID() *string { - if o == nil { - return nil - } - return o.SourceID -} - -func (o *IncidentsChannelEntity) GetURL() *string { - if o == nil { - return nil - } - return o.URL -} - -func (o *IncidentsChannelEntity) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -func (o *IncidentsChannelEntity) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} diff --git a/internal/sdk/models/shared/incidentsconferencebridgeentity.go b/internal/sdk/models/shared/incidentsconferencebridgeentity.go deleted file mode 100644 index e6a01f9..0000000 --- a/internal/sdk/models/shared/incidentsconferencebridgeentity.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IncidentsConferenceBridgeEntityAttachments struct { -} - -type IncidentsConferenceBridgeEntity struct { - ID *string `json:"id,omitempty"` - // A list of objects attached to this item. Can be one of: LinkEntity, CustomerSupportIssueEntity, or GenericAttachmentEntity - Attachments []IncidentsConferenceBridgeEntityAttachments `json:"attachments,omitempty"` -} - -func (o *IncidentsConferenceBridgeEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsConferenceBridgeEntity) GetAttachments() []IncidentsConferenceBridgeEntityAttachments { - if o == nil { - return nil - } - return o.Attachments -} diff --git a/internal/sdk/models/shared/incidentscontextobjectentity.go b/internal/sdk/models/shared/incidentscontextobjectentity.go deleted file mode 100644 index 02d44a0..0000000 --- a/internal/sdk/models/shared/incidentscontextobjectentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IncidentsContextObjectEntity struct { - ObjectType *string `json:"object_type,omitempty"` - ObjectID *string `json:"object_id,omitempty"` - ContextTag *string `json:"context_tag,omitempty"` - ContextDescription *string `json:"context_description,omitempty"` -} - -func (o *IncidentsContextObjectEntity) GetObjectType() *string { - if o == nil { - return nil - } - return o.ObjectType -} - -func (o *IncidentsContextObjectEntity) GetObjectID() *string { - if o == nil { - return nil - } - return o.ObjectID -} - -func (o *IncidentsContextObjectEntity) GetContextTag() *string { - if o == nil { - return nil - } - return o.ContextTag -} - -func (o *IncidentsContextObjectEntity) GetContextDescription() *string { - if o == nil { - return nil - } - return o.ContextDescription -} diff --git a/internal/sdk/models/shared/incidentsimpactentity.go b/internal/sdk/models/shared/incidentsimpactentity.go deleted file mode 100644 index f39562b..0000000 --- a/internal/sdk/models/shared/incidentsimpactentity.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type IncidentsImpactEntityType string - -const ( - IncidentsImpactEntityTypeEnvironment IncidentsImpactEntityType = "environment" - IncidentsImpactEntityTypeFunctionality IncidentsImpactEntityType = "functionality" - IncidentsImpactEntityTypeService IncidentsImpactEntityType = "service" -) - -func (e IncidentsImpactEntityType) ToPointer() *IncidentsImpactEntityType { - return &e -} -func (e *IncidentsImpactEntityType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "environment": - fallthrough - case "functionality": - fallthrough - case "service": - *e = IncidentsImpactEntityType(v) - return nil - default: - return fmt.Errorf("invalid value for IncidentsImpactEntityType: %v", v) - } -} - -type IncidentsImpactEntity struct { - ID *string `json:"id,omitempty"` - Type *IncidentsImpactEntityType `json:"type,omitempty"` - Impact *SuccinctEntity `json:"impact,omitempty"` - // SeverityMatrix_ConditionEntity model - Condition *SeverityMatrixConditionEntity `json:"condition,omitempty"` - Conversations []ConversationsAPIEntitiesReference `json:"conversations,omitempty"` -} - -func (o *IncidentsImpactEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsImpactEntity) GetType() *IncidentsImpactEntityType { - if o == nil { - return nil - } - return o.Type -} - -func (o *IncidentsImpactEntity) GetImpact() *SuccinctEntity { - if o == nil { - return nil - } - return o.Impact -} - -func (o *IncidentsImpactEntity) GetCondition() *SeverityMatrixConditionEntity { - if o == nil { - return nil - } - return o.Condition -} - -func (o *IncidentsImpactEntity) GetConversations() []ConversationsAPIEntitiesReference { - if o == nil { - return nil - } - return o.Conversations -} diff --git a/internal/sdk/models/shared/incidentslifecyclemeasuremententity.go b/internal/sdk/models/shared/incidentslifecyclemeasuremententity.go deleted file mode 100644 index 3300396..0000000 --- a/internal/sdk/models/shared/incidentslifecyclemeasuremententity.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type IncidentsLifecycleMeasurementEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Slug *string `json:"slug,omitempty"` - StartsAtMilestone *string `json:"starts_at_milestone,omitempty"` - EndsAtMilestone *string `json:"ends_at_milestone,omitempty"` - Value *string `json:"value,omitempty"` - CalculatedAt *time.Time `json:"calculated_at,omitempty"` -} - -func (i IncidentsLifecycleMeasurementEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentsLifecycleMeasurementEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentsLifecycleMeasurementEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsLifecycleMeasurementEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentsLifecycleMeasurementEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *IncidentsLifecycleMeasurementEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *IncidentsLifecycleMeasurementEntity) GetStartsAtMilestone() *string { - if o == nil { - return nil - } - return o.StartsAtMilestone -} - -func (o *IncidentsLifecycleMeasurementEntity) GetEndsAtMilestone() *string { - if o == nil { - return nil - } - return o.EndsAtMilestone -} - -func (o *IncidentsLifecycleMeasurementEntity) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} - -func (o *IncidentsLifecycleMeasurementEntity) GetCalculatedAt() *time.Time { - if o == nil { - return nil - } - return o.CalculatedAt -} diff --git a/internal/sdk/models/shared/incidentslifecyclemilestoneentity.go b/internal/sdk/models/shared/incidentslifecyclemilestoneentity.go deleted file mode 100644 index 28b5960..0000000 --- a/internal/sdk/models/shared/incidentslifecyclemilestoneentity.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type IncidentsLifecycleMilestoneEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Slug *string `json:"slug,omitempty"` - Position *int `json:"position,omitempty"` - OccurredAt *time.Time `json:"occurred_at,omitempty"` - Duration *string `json:"duration,omitempty"` - UpdatedBy *AuthorEntity `json:"updated_by,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (i IncidentsLifecycleMilestoneEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentsLifecycleMilestoneEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentsLifecycleMilestoneEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsLifecycleMilestoneEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentsLifecycleMilestoneEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *IncidentsLifecycleMilestoneEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *IncidentsLifecycleMilestoneEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *IncidentsLifecycleMilestoneEntity) GetOccurredAt() *time.Time { - if o == nil { - return nil - } - return o.OccurredAt -} - -func (o *IncidentsLifecycleMilestoneEntity) GetDuration() *string { - if o == nil { - return nil - } - return o.Duration -} - -func (o *IncidentsLifecycleMilestoneEntity) GetUpdatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.UpdatedBy -} - -func (o *IncidentsLifecycleMilestoneEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} diff --git a/internal/sdk/models/shared/incidentslifecyclephaseentity.go b/internal/sdk/models/shared/incidentslifecyclephaseentity.go deleted file mode 100644 index e43d7d8..0000000 --- a/internal/sdk/models/shared/incidentslifecyclephaseentity.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IncidentsLifecyclePhaseEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - Position *int `json:"position,omitempty"` - Milestones []IncidentsLifecycleMilestoneEntity `json:"milestones,omitempty"` -} - -func (o *IncidentsLifecyclePhaseEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsLifecyclePhaseEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentsLifecyclePhaseEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *IncidentsLifecyclePhaseEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *IncidentsLifecyclePhaseEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *IncidentsLifecyclePhaseEntity) GetMilestones() []IncidentsLifecycleMilestoneEntity { - if o == nil { - return nil - } - return o.Milestones -} diff --git a/internal/sdk/models/shared/incidentsmilestoneentity.go b/internal/sdk/models/shared/incidentsmilestoneentity.go deleted file mode 100644 index bb846ab..0000000 --- a/internal/sdk/models/shared/incidentsmilestoneentity.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type IncidentsMilestoneEntity struct { - ID *string `json:"id,omitempty"` - // The milestone's type. This will be one of the currently configured milestones for the given incident. - Type *string `json:"type,omitempty"` - // How long the incident spent in this milestones, in ISO 8601 Duration Format. This will be null if the milestone is the incident's current milestone. - Duration *string `json:"duration,omitempty"` - OccurredAt *time.Time `json:"occurred_at,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (i IncidentsMilestoneEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentsMilestoneEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentsMilestoneEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsMilestoneEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *IncidentsMilestoneEntity) GetDuration() *string { - if o == nil { - return nil - } - return o.Duration -} - -func (o *IncidentsMilestoneEntity) GetOccurredAt() *time.Time { - if o == nil { - return nil - } - return o.OccurredAt -} - -func (o *IncidentsMilestoneEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IncidentsMilestoneEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} diff --git a/internal/sdk/models/shared/incidentsmilestoneentitypaginated.go b/internal/sdk/models/shared/incidentsmilestoneentitypaginated.go deleted file mode 100644 index 8fb526a..0000000 --- a/internal/sdk/models/shared/incidentsmilestoneentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsMilestoneEntityPaginated - Incidents_MilestoneEntityPaginated model -type IncidentsMilestoneEntityPaginated struct { - Data []IncidentsMilestoneEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentsMilestoneEntityPaginated) GetData() []IncidentsMilestoneEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentsMilestoneEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentsrelatedchangeevententity.go b/internal/sdk/models/shared/incidentsrelatedchangeevententity.go deleted file mode 100644 index 84f5658..0000000 --- a/internal/sdk/models/shared/incidentsrelatedchangeevententity.go +++ /dev/null @@ -1,123 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type IncidentsRelatedChangeEventEntityType string - -const ( - IncidentsRelatedChangeEventEntityTypeCaused IncidentsRelatedChangeEventEntityType = "caused" - IncidentsRelatedChangeEventEntityTypeFixed IncidentsRelatedChangeEventEntityType = "fixed" - IncidentsRelatedChangeEventEntityTypeSuspect IncidentsRelatedChangeEventEntityType = "suspect" - IncidentsRelatedChangeEventEntityTypeDismissed IncidentsRelatedChangeEventEntityType = "dismissed" -) - -func (e IncidentsRelatedChangeEventEntityType) ToPointer() *IncidentsRelatedChangeEventEntityType { - return &e -} -func (e *IncidentsRelatedChangeEventEntityType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "caused": - fallthrough - case "fixed": - fallthrough - case "suspect": - fallthrough - case "dismissed": - *e = IncidentsRelatedChangeEventEntityType(v) - return nil - default: - return fmt.Errorf("invalid value for IncidentsRelatedChangeEventEntityType: %v", v) - } -} - -// IncidentsRelatedChangeEventEntity - Incidents_RelatedChangeEventEntity model -type IncidentsRelatedChangeEventEntity struct { - ID *string `json:"id,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // The reason why this change event is related to this incident - Why *string `json:"why,omitempty"` - Type *IncidentsRelatedChangeEventEntityType `json:"type,omitempty"` - // ChangeEventEntity model - ChangeEvent *ChangeEventEntity `json:"change_event,omitempty"` - IncidentID *string `json:"incident_id,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` -} - -func (i IncidentsRelatedChangeEventEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentsRelatedChangeEventEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentsRelatedChangeEventEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsRelatedChangeEventEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IncidentsRelatedChangeEventEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *IncidentsRelatedChangeEventEntity) GetWhy() *string { - if o == nil { - return nil - } - return o.Why -} - -func (o *IncidentsRelatedChangeEventEntity) GetType() *IncidentsRelatedChangeEventEntityType { - if o == nil { - return nil - } - return o.Type -} - -func (o *IncidentsRelatedChangeEventEntity) GetChangeEvent() *ChangeEventEntity { - if o == nil { - return nil - } - return o.ChangeEvent -} - -func (o *IncidentsRelatedChangeEventEntity) GetIncidentID() *string { - if o == nil { - return nil - } - return o.IncidentID -} - -func (o *IncidentsRelatedChangeEventEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} diff --git a/internal/sdk/models/shared/incidentsrelatedchangeevententitypaginated.go b/internal/sdk/models/shared/incidentsrelatedchangeevententitypaginated.go deleted file mode 100644 index 17d3b2a..0000000 --- a/internal/sdk/models/shared/incidentsrelatedchangeevententitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsRelatedChangeEventEntityPaginated - Incidents_RelatedChangeEventEntityPaginated model -type IncidentsRelatedChangeEventEntityPaginated struct { - Data []IncidentsRelatedChangeEventEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentsRelatedChangeEventEntityPaginated) GetData() []IncidentsRelatedChangeEventEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentsRelatedChangeEventEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentsrelationshipsentity.go b/internal/sdk/models/shared/incidentsrelationshipsentity.go deleted file mode 100644 index 85fdc2c..0000000 --- a/internal/sdk/models/shared/incidentsrelationshipsentity.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsRelationshipsEntity - Incidents_RelationshipsEntity model -type IncidentsRelationshipsEntity struct { - Parent *PublicAPIV1IncidentsSuccinctEntity `json:"parent,omitempty"` - // The root incident's child incidents. - Children []PublicAPIV1IncidentsSuccinctEntity `json:"children,omitempty"` - // A list of incidents that share the root incident's parent. - Siblings []PublicAPIV1IncidentsSuccinctEntity `json:"siblings,omitempty"` -} - -func (o *IncidentsRelationshipsEntity) GetParent() *PublicAPIV1IncidentsSuccinctEntity { - if o == nil { - return nil - } - return o.Parent -} - -func (o *IncidentsRelationshipsEntity) GetChildren() []PublicAPIV1IncidentsSuccinctEntity { - if o == nil { - return nil - } - return o.Children -} - -func (o *IncidentsRelationshipsEntity) GetSiblings() []PublicAPIV1IncidentsSuccinctEntity { - if o == nil { - return nil - } - return o.Siblings -} diff --git a/internal/sdk/models/shared/incidentsroleassignmententity.go b/internal/sdk/models/shared/incidentsroleassignmententity.go deleted file mode 100644 index 4c007cb..0000000 --- a/internal/sdk/models/shared/incidentsroleassignmententity.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type Status string - -const ( - StatusActive Status = "active" - StatusInactive Status = "inactive" -) - -func (e Status) ToPointer() *Status { - return &e -} -func (e *Status) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "active": - fallthrough - case "inactive": - *e = Status(v) - return nil - default: - return fmt.Errorf("invalid value for Status: %v", v) - } -} - -// IncidentsRoleAssignmentEntity - Incidents_RoleAssignmentEntity model -type IncidentsRoleAssignmentEntity struct { - ID *string `json:"id,omitempty"` - Status *Status `json:"status,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // IncidentRoleEntity model - IncidentRole *IncidentRoleEntity `json:"incident_role,omitempty"` - User *UserEntity `json:"user,omitempty"` -} - -func (i IncidentsRoleAssignmentEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentsRoleAssignmentEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentsRoleAssignmentEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsRoleAssignmentEntity) GetStatus() *Status { - if o == nil { - return nil - } - return o.Status -} - -func (o *IncidentsRoleAssignmentEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IncidentsRoleAssignmentEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *IncidentsRoleAssignmentEntity) GetIncidentRole() *IncidentRoleEntity { - if o == nil { - return nil - } - return o.IncidentRole -} - -func (o *IncidentsRoleAssignmentEntity) GetUser() *UserEntity { - if o == nil { - return nil - } - return o.User -} diff --git a/internal/sdk/models/shared/incidentsroleassignmententitypaginated.go b/internal/sdk/models/shared/incidentsroleassignmententitypaginated.go deleted file mode 100644 index 2508be0..0000000 --- a/internal/sdk/models/shared/incidentsroleassignmententitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsRoleAssignmentEntityPaginated - Incidents_RoleAssignmentEntityPaginated model -type IncidentsRoleAssignmentEntityPaginated struct { - Data []IncidentsRoleAssignmentEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentsRoleAssignmentEntityPaginated) GetData() []IncidentsRoleAssignmentEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentsRoleAssignmentEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentsstatuspageentity.go b/internal/sdk/models/shared/incidentsstatuspageentity.go deleted file mode 100644 index 9054a91..0000000 --- a/internal/sdk/models/shared/incidentsstatuspageentity.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsStatusPageEntity - Incidents_StatusPageEntity model -type IncidentsStatusPageEntity struct { - ID *string `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - ExternalID *string `json:"external_id,omitempty"` - Name *string `json:"name,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - Integration *IntegrationEntity `json:"integration,omitempty"` -} - -func (o *IncidentsStatusPageEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsStatusPageEntity) GetURL() *string { - if o == nil { - return nil - } - return o.URL -} - -func (o *IncidentsStatusPageEntity) GetExternalID() *string { - if o == nil { - return nil - } - return o.ExternalID -} - -func (o *IncidentsStatusPageEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentsStatusPageEntity) GetDisplayName() *string { - if o == nil { - return nil - } - return o.DisplayName -} - -func (o *IncidentsStatusPageEntity) GetIntegration() *IntegrationEntity { - if o == nil { - return nil - } - return o.Integration -} diff --git a/internal/sdk/models/shared/incidentsstatuspageentitypaginated.go b/internal/sdk/models/shared/incidentsstatuspageentitypaginated.go deleted file mode 100644 index f3eefa9..0000000 --- a/internal/sdk/models/shared/incidentsstatuspageentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentsStatusPageEntityPaginated - Incidents_StatusPageEntityPaginated model -type IncidentsStatusPageEntityPaginated struct { - Data []IncidentsStatusPageEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentsStatusPageEntityPaginated) GetData() []IncidentsStatusPageEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentsStatusPageEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidentsteamassignmententity.go b/internal/sdk/models/shared/incidentsteamassignmententity.go deleted file mode 100644 index 83b447c..0000000 --- a/internal/sdk/models/shared/incidentsteamassignmententity.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type IncidentsTeamAssignmentEntity struct { - ID *string `json:"id,omitempty"` - Status *string `json:"status,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // TeamEntity model - Team *TeamEntity `json:"team,omitempty"` -} - -func (i IncidentsTeamAssignmentEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentsTeamAssignmentEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentsTeamAssignmentEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentsTeamAssignmentEntity) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *IncidentsTeamAssignmentEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IncidentsTeamAssignmentEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *IncidentsTeamAssignmentEntity) GetTeam() *TeamEntity { - if o == nil { - return nil - } - return o.Team -} diff --git a/internal/sdk/models/shared/incidenttypeentity.go b/internal/sdk/models/shared/incidenttypeentity.go deleted file mode 100644 index 59a3fe4..0000000 --- a/internal/sdk/models/shared/incidenttypeentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// IncidentTypeEntity model -type IncidentTypeEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Template *IncidentTypeEntityTemplateEntity `json:"template,omitempty"` - TemplateValues *IncidentTypeEntityTemplateValuesEntity `json:"template_values,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (i IncidentTypeEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IncidentTypeEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IncidentTypeEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentTypeEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentTypeEntity) GetTemplate() *IncidentTypeEntityTemplateEntity { - if o == nil { - return nil - } - return o.Template -} - -func (o *IncidentTypeEntity) GetTemplateValues() *IncidentTypeEntityTemplateValuesEntity { - if o == nil { - return nil - } - return o.TemplateValues -} - -func (o *IncidentTypeEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IncidentTypeEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} diff --git a/internal/sdk/models/shared/incidenttypeentitypaginated.go b/internal/sdk/models/shared/incidenttypeentitypaginated.go deleted file mode 100644 index f408846..0000000 --- a/internal/sdk/models/shared/incidenttypeentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IncidentTypeEntityPaginated model -type IncidentTypeEntityPaginated struct { - Data []IncidentTypeEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IncidentTypeEntityPaginated) GetData() []IncidentTypeEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IncidentTypeEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/incidenttypeentitytemplateentity.go b/internal/sdk/models/shared/incidenttypeentitytemplateentity.go deleted file mode 100644 index 8ccf0a9..0000000 --- a/internal/sdk/models/shared/incidenttypeentitytemplateentity.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IncidentTypeEntityTemplateEntity struct { - IncidentName *string `json:"incident_name,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - CustomerImpactSummary *string `json:"customer_impact_summary,omitempty"` - // Arbitrary key:value pairs of labels for your incidents. - Labels map[string]string `json:"labels,omitempty"` - Severity *string `json:"severity,omitempty"` - Priority *string `json:"priority,omitempty"` - TagList []string `json:"tag_list,omitempty"` - RunbookIds []string `json:"runbook_ids,omitempty"` - TeamIds []string `json:"team_ids,omitempty"` - PrivateIncident *bool `json:"private_incident,omitempty"` - CustomFields *string `json:"custom_fields,omitempty"` - Impacts []IncidentTypeEntityTemplateImpactEntity `json:"impacts,omitempty"` -} - -func (o *IncidentTypeEntityTemplateEntity) GetIncidentName() *string { - if o == nil { - return nil - } - return o.IncidentName -} - -func (o *IncidentTypeEntityTemplateEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *IncidentTypeEntityTemplateEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *IncidentTypeEntityTemplateEntity) GetCustomerImpactSummary() *string { - if o == nil { - return nil - } - return o.CustomerImpactSummary -} - -func (o *IncidentTypeEntityTemplateEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *IncidentTypeEntityTemplateEntity) GetSeverity() *string { - if o == nil { - return nil - } - return o.Severity -} - -func (o *IncidentTypeEntityTemplateEntity) GetPriority() *string { - if o == nil { - return nil - } - return o.Priority -} - -func (o *IncidentTypeEntityTemplateEntity) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} - -func (o *IncidentTypeEntityTemplateEntity) GetRunbookIds() []string { - if o == nil { - return nil - } - return o.RunbookIds -} - -func (o *IncidentTypeEntityTemplateEntity) GetTeamIds() []string { - if o == nil { - return nil - } - return o.TeamIds -} - -func (o *IncidentTypeEntityTemplateEntity) GetPrivateIncident() *bool { - if o == nil { - return nil - } - return o.PrivateIncident -} - -func (o *IncidentTypeEntityTemplateEntity) GetCustomFields() *string { - if o == nil { - return nil - } - return o.CustomFields -} - -func (o *IncidentTypeEntityTemplateEntity) GetImpacts() []IncidentTypeEntityTemplateImpactEntity { - if o == nil { - return nil - } - return o.Impacts -} diff --git a/internal/sdk/models/shared/incidenttypeentitytemplateimpactentity.go b/internal/sdk/models/shared/incidenttypeentitytemplateimpactentity.go deleted file mode 100644 index 6522f9e..0000000 --- a/internal/sdk/models/shared/incidenttypeentitytemplateimpactentity.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type IncidentTypeEntityTemplateImpactEntityType string - -const ( - IncidentTypeEntityTemplateImpactEntityTypeEnvironment IncidentTypeEntityTemplateImpactEntityType = "environment" - IncidentTypeEntityTemplateImpactEntityTypeFunctionality IncidentTypeEntityTemplateImpactEntityType = "functionality" - IncidentTypeEntityTemplateImpactEntityTypeService IncidentTypeEntityTemplateImpactEntityType = "service" -) - -func (e IncidentTypeEntityTemplateImpactEntityType) ToPointer() *IncidentTypeEntityTemplateImpactEntityType { - return &e -} -func (e *IncidentTypeEntityTemplateImpactEntityType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "environment": - fallthrough - case "functionality": - fallthrough - case "service": - *e = IncidentTypeEntityTemplateImpactEntityType(v) - return nil - default: - return fmt.Errorf("invalid value for IncidentTypeEntityTemplateImpactEntityType: %v", v) - } -} - -type IncidentTypeEntityTemplateImpactEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ConditionID *string `json:"condition_id,omitempty"` - ConditionName *string `json:"condition_name,omitempty"` - Type *IncidentTypeEntityTemplateImpactEntityType `json:"type,omitempty"` -} - -func (o *IncidentTypeEntityTemplateImpactEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IncidentTypeEntityTemplateImpactEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IncidentTypeEntityTemplateImpactEntity) GetConditionID() *string { - if o == nil { - return nil - } - return o.ConditionID -} - -func (o *IncidentTypeEntityTemplateImpactEntity) GetConditionName() *string { - if o == nil { - return nil - } - return o.ConditionName -} - -func (o *IncidentTypeEntityTemplateImpactEntity) GetType() *IncidentTypeEntityTemplateImpactEntityType { - if o == nil { - return nil - } - return o.Type -} diff --git a/internal/sdk/models/shared/incidenttypeentitytemplatevaluesentity.go b/internal/sdk/models/shared/incidenttypeentitytemplatevaluesentity.go deleted file mode 100644 index cc19247..0000000 --- a/internal/sdk/models/shared/incidenttypeentitytemplatevaluesentity.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// Runbooks - A hash mapping runbook IDs to runbook names. -type Runbooks struct { -} - -type IncidentTypeEntityTemplateValuesEntity struct { - Services []IncidentTypeEntityTemplateImpactEntity `json:"services,omitempty"` - Functionalities []IncidentTypeEntityTemplateImpactEntity `json:"functionalities,omitempty"` - Environments []IncidentTypeEntityTemplateImpactEntity `json:"environments,omitempty"` - // A hash mapping runbook IDs to runbook names. - Runbooks *Runbooks `json:"runbooks,omitempty"` - Teams []TeamEntity `json:"teams,omitempty"` -} - -func (o *IncidentTypeEntityTemplateValuesEntity) GetServices() []IncidentTypeEntityTemplateImpactEntity { - if o == nil { - return nil - } - return o.Services -} - -func (o *IncidentTypeEntityTemplateValuesEntity) GetFunctionalities() []IncidentTypeEntityTemplateImpactEntity { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *IncidentTypeEntityTemplateValuesEntity) GetEnvironments() []IncidentTypeEntityTemplateImpactEntity { - if o == nil { - return nil - } - return o.Environments -} - -func (o *IncidentTypeEntityTemplateValuesEntity) GetRunbooks() *Runbooks { - if o == nil { - return nil - } - return o.Runbooks -} - -func (o *IncidentTypeEntityTemplateValuesEntity) GetTeams() []TeamEntity { - if o == nil { - return nil - } - return o.Teams -} diff --git a/internal/sdk/models/shared/infrastructuresearchentity.go b/internal/sdk/models/shared/infrastructuresearchentity.go deleted file mode 100644 index 641e48b..0000000 --- a/internal/sdk/models/shared/infrastructuresearchentity.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// InfrastructureSearchEntity model -type InfrastructureSearchEntity struct { - Type *string `json:"type,omitempty"` - Infrastructure *string `json:"infrastructure,omitempty"` -} - -func (o *InfrastructureSearchEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *InfrastructureSearchEntity) GetInfrastructure() *string { - if o == nil { - return nil - } - return o.Infrastructure -} diff --git a/internal/sdk/models/shared/integrationentity.go b/internal/sdk/models/shared/integrationentity.go deleted file mode 100644 index 766dcb2..0000000 --- a/internal/sdk/models/shared/integrationentity.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type IntegrationEntity struct { - ID *string `json:"id,omitempty"` - IntegrationName *string `json:"integration_name,omitempty"` - IntegrationSlug *string `json:"integration_slug,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` -} - -func (i IntegrationEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IntegrationEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IntegrationEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IntegrationEntity) GetIntegrationName() *string { - if o == nil { - return nil - } - return o.IntegrationName -} - -func (o *IntegrationEntity) GetIntegrationSlug() *string { - if o == nil { - return nil - } - return o.IntegrationSlug -} - -func (o *IntegrationEntity) GetDisplayName() *string { - if o == nil { - return nil - } - return o.DisplayName -} - -func (o *IntegrationEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} diff --git a/internal/sdk/models/shared/integrationsawscloudtrailbatchentity.go b/internal/sdk/models/shared/integrationsawscloudtrailbatchentity.go deleted file mode 100644 index e1e51c8..0000000 --- a/internal/sdk/models/shared/integrationsawscloudtrailbatchentity.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type IntegrationsAwsCloudtrailBatchEntityStatus string - -const ( - IntegrationsAwsCloudtrailBatchEntityStatusInProgress IntegrationsAwsCloudtrailBatchEntityStatus = "in_progress" - IntegrationsAwsCloudtrailBatchEntityStatusFailed IntegrationsAwsCloudtrailBatchEntityStatus = "failed" - IntegrationsAwsCloudtrailBatchEntityStatusSuccessful IntegrationsAwsCloudtrailBatchEntityStatus = "successful" - IntegrationsAwsCloudtrailBatchEntityStatusPending IntegrationsAwsCloudtrailBatchEntityStatus = "pending" - IntegrationsAwsCloudtrailBatchEntityStatusRetried IntegrationsAwsCloudtrailBatchEntityStatus = "retried" -) - -func (e IntegrationsAwsCloudtrailBatchEntityStatus) ToPointer() *IntegrationsAwsCloudtrailBatchEntityStatus { - return &e -} -func (e *IntegrationsAwsCloudtrailBatchEntityStatus) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "in_progress": - fallthrough - case "failed": - fallthrough - case "successful": - fallthrough - case "pending": - fallthrough - case "retried": - *e = IntegrationsAwsCloudtrailBatchEntityStatus(v) - return nil - default: - return fmt.Errorf("invalid value for IntegrationsAwsCloudtrailBatchEntityStatus: %v", v) - } -} - -// IntegrationsAwsCloudtrailBatchEntity - Integrations_Aws_CloudtrailBatchEntity model -type IntegrationsAwsCloudtrailBatchEntity struct { - ID *string `json:"id,omitempty"` - EventsCreated *int `json:"events_created,omitempty"` - Status *IntegrationsAwsCloudtrailBatchEntityStatus `json:"status,omitempty"` - StartsAt *time.Time `json:"starts_at,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` - // Integrations_Aws_ConnectionEntity model - Connection *IntegrationsAwsConnectionEntity `json:"connection,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` -} - -func (i IntegrationsAwsCloudtrailBatchEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IntegrationsAwsCloudtrailBatchEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IntegrationsAwsCloudtrailBatchEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IntegrationsAwsCloudtrailBatchEntity) GetEventsCreated() *int { - if o == nil { - return nil - } - return o.EventsCreated -} - -func (o *IntegrationsAwsCloudtrailBatchEntity) GetStatus() *IntegrationsAwsCloudtrailBatchEntityStatus { - if o == nil { - return nil - } - return o.Status -} - -func (o *IntegrationsAwsCloudtrailBatchEntity) GetStartsAt() *time.Time { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *IntegrationsAwsCloudtrailBatchEntity) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *IntegrationsAwsCloudtrailBatchEntity) GetConnection() *IntegrationsAwsConnectionEntity { - if o == nil { - return nil - } - return o.Connection -} - -func (o *IntegrationsAwsCloudtrailBatchEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} diff --git a/internal/sdk/models/shared/integrationsawscloudtrailbatchentitypaginated.go b/internal/sdk/models/shared/integrationsawscloudtrailbatchentitypaginated.go deleted file mode 100644 index 67ea704..0000000 --- a/internal/sdk/models/shared/integrationsawscloudtrailbatchentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IntegrationsAwsCloudtrailBatchEntityPaginated - Integrations_Aws_CloudtrailBatchEntityPaginated model -type IntegrationsAwsCloudtrailBatchEntityPaginated struct { - Data []IntegrationsAwsCloudtrailBatchEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IntegrationsAwsCloudtrailBatchEntityPaginated) GetData() []IntegrationsAwsCloudtrailBatchEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IntegrationsAwsCloudtrailBatchEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/integrationsawsconnectionentity.go b/internal/sdk/models/shared/integrationsawsconnectionentity.go deleted file mode 100644 index 83ca08d..0000000 --- a/internal/sdk/models/shared/integrationsawsconnectionentity.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type ConnectionStatus string - -const ( - ConnectionStatusPendingSetup ConnectionStatus = "pending_setup" - ConnectionStatusRoleAssumed ConnectionStatus = "role_assumed" - ConnectionStatusCantAssumeRole ConnectionStatus = "cant_assume_role" - ConnectionStatusInvalidPermissions ConnectionStatus = "invalid_permissions" - ConnectionStatusValidated ConnectionStatus = "validated" -) - -func (e ConnectionStatus) ToPointer() *ConnectionStatus { - return &e -} -func (e *ConnectionStatus) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "pending_setup": - fallthrough - case "role_assumed": - fallthrough - case "cant_assume_role": - fallthrough - case "invalid_permissions": - fallthrough - case "validated": - *e = ConnectionStatus(v) - return nil - default: - return fmt.Errorf("invalid value for ConnectionStatus: %v", v) - } -} - -// IntegrationsAwsConnectionEntity - Integrations_Aws_ConnectionEntity model -type IntegrationsAwsConnectionEntity struct { - ID *string `json:"id,omitempty"` - AwsAccountID *string `json:"aws_account_id,omitempty"` - TargetArn *string `json:"target_arn,omitempty"` - ExternalID *string `json:"external_id,omitempty"` - ConnectionStatus *ConnectionStatus `json:"connection_status,omitempty"` - StatusText *string `json:"status_text,omitempty"` - StatusDescription *string `json:"status_description,omitempty"` - EnvironmentID *string `json:"environment_id,omitempty"` - EnvironmentName *string `json:"environment_name,omitempty"` - Regions []string `json:"regions,omitempty"` -} - -func (o *IntegrationsAwsConnectionEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IntegrationsAwsConnectionEntity) GetAwsAccountID() *string { - if o == nil { - return nil - } - return o.AwsAccountID -} - -func (o *IntegrationsAwsConnectionEntity) GetTargetArn() *string { - if o == nil { - return nil - } - return o.TargetArn -} - -func (o *IntegrationsAwsConnectionEntity) GetExternalID() *string { - if o == nil { - return nil - } - return o.ExternalID -} - -func (o *IntegrationsAwsConnectionEntity) GetConnectionStatus() *ConnectionStatus { - if o == nil { - return nil - } - return o.ConnectionStatus -} - -func (o *IntegrationsAwsConnectionEntity) GetStatusText() *string { - if o == nil { - return nil - } - return o.StatusText -} - -func (o *IntegrationsAwsConnectionEntity) GetStatusDescription() *string { - if o == nil { - return nil - } - return o.StatusDescription -} - -func (o *IntegrationsAwsConnectionEntity) GetEnvironmentID() *string { - if o == nil { - return nil - } - return o.EnvironmentID -} - -func (o *IntegrationsAwsConnectionEntity) GetEnvironmentName() *string { - if o == nil { - return nil - } - return o.EnvironmentName -} - -func (o *IntegrationsAwsConnectionEntity) GetRegions() []string { - if o == nil { - return nil - } - return o.Regions -} diff --git a/internal/sdk/models/shared/integrationsawsconnectionentitypaginated.go b/internal/sdk/models/shared/integrationsawsconnectionentitypaginated.go deleted file mode 100644 index b094c8e..0000000 --- a/internal/sdk/models/shared/integrationsawsconnectionentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IntegrationsAwsConnectionEntityPaginated - Integrations_Aws_ConnectionEntityPaginated model -type IntegrationsAwsConnectionEntityPaginated struct { - Data []IntegrationsAwsConnectionEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IntegrationsAwsConnectionEntityPaginated) GetData() []IntegrationsAwsConnectionEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IntegrationsAwsConnectionEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/integrationsconfluencecloudspacekeyentity.go b/internal/sdk/models/shared/integrationsconfluencecloudspacekeyentity.go deleted file mode 100644 index a54eaad..0000000 --- a/internal/sdk/models/shared/integrationsconfluencecloudspacekeyentity.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IntegrationsConfluenceCloudSpaceKeyEntity - Integrations_ConfluenceCloud_SpaceKeyEntity model -type IntegrationsConfluenceCloudSpaceKeyEntity struct { - Key *string `json:"key,omitempty"` - Name *string `json:"name,omitempty"` -} - -func (o *IntegrationsConfluenceCloudSpaceKeyEntity) GetKey() *string { - if o == nil { - return nil - } - return o.Key -} - -func (o *IntegrationsConfluenceCloudSpaceKeyEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/integrationsconnectionentity.go b/internal/sdk/models/shared/integrationsconnectionentity.go deleted file mode 100644 index 4b351d0..0000000 --- a/internal/sdk/models/shared/integrationsconnectionentity.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// Details - Integration-specific details of this connection. As identified by the integration_slug, this object will be represented by that integration's ConnectionEntity. -type Details struct { -} - -type IntegrationsConnectionEntity struct { - ID *string `json:"id,omitempty"` - IntegrationSlug *string `json:"integration_slug,omitempty"` - IntegrationID *string `json:"integration_id,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - ConfigurationURL *string `json:"configuration_url,omitempty"` - AuthorizedBy *string `json:"authorized_by,omitempty"` - AuthorizedByID *string `json:"authorized_by_id,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // Integration-specific details of this connection. As identified by the integration_slug, this object will be represented by that integration's ConnectionEntity. - Details *Details `json:"details,omitempty"` - DefaultAuthorizedActor *AuthorEntity `json:"default_authorized_actor,omitempty"` -} - -func (i IntegrationsConnectionEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IntegrationsConnectionEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IntegrationsConnectionEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IntegrationsConnectionEntity) GetIntegrationSlug() *string { - if o == nil { - return nil - } - return o.IntegrationSlug -} - -func (o *IntegrationsConnectionEntity) GetIntegrationID() *string { - if o == nil { - return nil - } - return o.IntegrationID -} - -func (o *IntegrationsConnectionEntity) GetDisplayName() *string { - if o == nil { - return nil - } - return o.DisplayName -} - -func (o *IntegrationsConnectionEntity) GetConfigurationURL() *string { - if o == nil { - return nil - } - return o.ConfigurationURL -} - -func (o *IntegrationsConnectionEntity) GetAuthorizedBy() *string { - if o == nil { - return nil - } - return o.AuthorizedBy -} - -func (o *IntegrationsConnectionEntity) GetAuthorizedByID() *string { - if o == nil { - return nil - } - return o.AuthorizedByID -} - -func (o *IntegrationsConnectionEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IntegrationsConnectionEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *IntegrationsConnectionEntity) GetDetails() *Details { - if o == nil { - return nil - } - return o.Details -} - -func (o *IntegrationsConnectionEntity) GetDefaultAuthorizedActor() *AuthorEntity { - if o == nil { - return nil - } - return o.DefaultAuthorizedActor -} diff --git a/internal/sdk/models/shared/integrationsintegrationentity.go b/internal/sdk/models/shared/integrationsintegrationentity.go deleted file mode 100644 index 493ca6a..0000000 --- a/internal/sdk/models/shared/integrationsintegrationentity.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// IntegrationsIntegrationEntity - Integrations_IntegrationEntity model -type IntegrationsIntegrationEntity struct { - ID *string `json:"id,omitempty"` - Slug *string `json:"slug,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - SetupURL *string `json:"setup_url,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - Connections *IntegrationsConnectionEntity `json:"connections,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Installed *bool `json:"installed,omitempty"` - Deprecated *bool `json:"deprecated,omitempty"` - Logo *IntegrationsIntegrationEntityLogoEntity `json:"logo,omitempty"` - NatIP *string `json:"nat_ip,omitempty"` -} - -func (i IntegrationsIntegrationEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(i, "", false) -} - -func (i *IntegrationsIntegrationEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { - return err - } - return nil -} - -func (o *IntegrationsIntegrationEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IntegrationsIntegrationEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *IntegrationsIntegrationEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IntegrationsIntegrationEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *IntegrationsIntegrationEntity) GetSetupURL() *string { - if o == nil { - return nil - } - return o.SetupURL -} - -func (o *IntegrationsIntegrationEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *IntegrationsIntegrationEntity) GetConnections() *IntegrationsConnectionEntity { - if o == nil { - return nil - } - return o.Connections -} - -func (o *IntegrationsIntegrationEntity) GetEnabled() *bool { - if o == nil { - return nil - } - return o.Enabled -} - -func (o *IntegrationsIntegrationEntity) GetInstalled() *bool { - if o == nil { - return nil - } - return o.Installed -} - -func (o *IntegrationsIntegrationEntity) GetDeprecated() *bool { - if o == nil { - return nil - } - return o.Deprecated -} - -func (o *IntegrationsIntegrationEntity) GetLogo() *IntegrationsIntegrationEntityLogoEntity { - if o == nil { - return nil - } - return o.Logo -} - -func (o *IntegrationsIntegrationEntity) GetNatIP() *string { - if o == nil { - return nil - } - return o.NatIP -} diff --git a/internal/sdk/models/shared/integrationsintegrationentitylogoentity.go b/internal/sdk/models/shared/integrationsintegrationentitylogoentity.go deleted file mode 100644 index 8574466..0000000 --- a/internal/sdk/models/shared/integrationsintegrationentitylogoentity.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IntegrationsIntegrationEntityLogoEntity struct { - LogoURL *string `json:"logo_url,omitempty"` -} - -func (o *IntegrationsIntegrationEntityLogoEntity) GetLogoURL() *string { - if o == nil { - return nil - } - return o.LogoURL -} diff --git a/internal/sdk/models/shared/integrationsmicrosoftteamsv2channelentity.go b/internal/sdk/models/shared/integrationsmicrosoftteamsv2channelentity.go deleted file mode 100644 index 49ac39a..0000000 --- a/internal/sdk/models/shared/integrationsmicrosoftteamsv2channelentity.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IntegrationsMicrosoftTeamsV2ChannelEntity struct { - ID *string `json:"id,omitempty"` - ChannelID *string `json:"channel_id,omitempty"` - ChannelName *string `json:"channel_name,omitempty"` - MsTeamID *string `json:"ms_team_id,omitempty"` - TeamName *string `json:"team_name,omitempty"` - ChannelURL *string `json:"channel_url,omitempty"` - Status *string `json:"status,omitempty"` -} - -func (o *IntegrationsMicrosoftTeamsV2ChannelEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IntegrationsMicrosoftTeamsV2ChannelEntity) GetChannelID() *string { - if o == nil { - return nil - } - return o.ChannelID -} - -func (o *IntegrationsMicrosoftTeamsV2ChannelEntity) GetChannelName() *string { - if o == nil { - return nil - } - return o.ChannelName -} - -func (o *IntegrationsMicrosoftTeamsV2ChannelEntity) GetMsTeamID() *string { - if o == nil { - return nil - } - return o.MsTeamID -} - -func (o *IntegrationsMicrosoftTeamsV2ChannelEntity) GetTeamName() *string { - if o == nil { - return nil - } - return o.TeamName -} - -func (o *IntegrationsMicrosoftTeamsV2ChannelEntity) GetChannelURL() *string { - if o == nil { - return nil - } - return o.ChannelURL -} - -func (o *IntegrationsMicrosoftTeamsV2ChannelEntity) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} diff --git a/internal/sdk/models/shared/integrationsslackslackchannelentity.go b/internal/sdk/models/shared/integrationsslackslackchannelentity.go deleted file mode 100644 index a62fa86..0000000 --- a/internal/sdk/models/shared/integrationsslackslackchannelentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IntegrationsSlackSlackChannelEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - SlackChannelID *string `json:"slack_channel_id,omitempty"` -} - -func (o *IntegrationsSlackSlackChannelEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IntegrationsSlackSlackChannelEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *IntegrationsSlackSlackChannelEntity) GetSlackChannelID() *string { - if o == nil { - return nil - } - return o.SlackChannelID -} diff --git a/internal/sdk/models/shared/integrationsstatuspageconditionentity.go b/internal/sdk/models/shared/integrationsstatuspageconditionentity.go deleted file mode 100644 index 818bb52..0000000 --- a/internal/sdk/models/shared/integrationsstatuspageconditionentity.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type StatuspageioCondition string - -const ( - StatuspageioConditionOperational StatuspageioCondition = "operational" - StatuspageioConditionMajorOutage StatuspageioCondition = "major_outage" - StatuspageioConditionMinorOutage StatuspageioCondition = "minor_outage" - StatuspageioConditionDegradedPerformance StatuspageioCondition = "degraded_performance" -) - -func (e StatuspageioCondition) ToPointer() *StatuspageioCondition { - return &e -} -func (e *StatuspageioCondition) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "operational": - fallthrough - case "major_outage": - fallthrough - case "minor_outage": - fallthrough - case "degraded_performance": - *e = StatuspageioCondition(v) - return nil - default: - return fmt.Errorf("invalid value for StatuspageioCondition: %v", v) - } -} - -type IntegrationsStatuspageConditionEntity struct { - ConditionID *string `json:"condition_id,omitempty"` - ConditionName *string `json:"condition_name,omitempty"` - StatuspageioCondition *StatuspageioCondition `json:"statuspageio_condition,omitempty"` -} - -func (o *IntegrationsStatuspageConditionEntity) GetConditionID() *string { - if o == nil { - return nil - } - return o.ConditionID -} - -func (o *IntegrationsStatuspageConditionEntity) GetConditionName() *string { - if o == nil { - return nil - } - return o.ConditionName -} - -func (o *IntegrationsStatuspageConditionEntity) GetStatuspageioCondition() *StatuspageioCondition { - if o == nil { - return nil - } - return o.StatuspageioCondition -} diff --git a/internal/sdk/models/shared/integrationsstatuspageconnectionentity.go b/internal/sdk/models/shared/integrationsstatuspageconnectionentity.go deleted file mode 100644 index b145e9c..0000000 --- a/internal/sdk/models/shared/integrationsstatuspageconnectionentity.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IntegrationsStatuspageConnectionEntity - Integrations_Statuspage_ConnectionEntity model -type IntegrationsStatuspageConnectionEntity struct { - ID *string `json:"id,omitempty"` - PageName *string `json:"page_name,omitempty"` - PageID *string `json:"page_id,omitempty"` - Conditions []IntegrationsStatuspageConditionEntity `json:"conditions,omitempty"` - Severities []IntegrationsStatuspageSeverityEntity `json:"severities,omitempty"` - MilestoneMappings []IntegrationsStatuspageMilestoneMappingEntity `json:"milestone_mappings,omitempty"` -} - -func (o *IntegrationsStatuspageConnectionEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *IntegrationsStatuspageConnectionEntity) GetPageName() *string { - if o == nil { - return nil - } - return o.PageName -} - -func (o *IntegrationsStatuspageConnectionEntity) GetPageID() *string { - if o == nil { - return nil - } - return o.PageID -} - -func (o *IntegrationsStatuspageConnectionEntity) GetConditions() []IntegrationsStatuspageConditionEntity { - if o == nil { - return nil - } - return o.Conditions -} - -func (o *IntegrationsStatuspageConnectionEntity) GetSeverities() []IntegrationsStatuspageSeverityEntity { - if o == nil { - return nil - } - return o.Severities -} - -func (o *IntegrationsStatuspageConnectionEntity) GetMilestoneMappings() []IntegrationsStatuspageMilestoneMappingEntity { - if o == nil { - return nil - } - return o.MilestoneMappings -} diff --git a/internal/sdk/models/shared/integrationsstatuspageconnectionentitypaginated.go b/internal/sdk/models/shared/integrationsstatuspageconnectionentitypaginated.go deleted file mode 100644 index 9f4fa17..0000000 --- a/internal/sdk/models/shared/integrationsstatuspageconnectionentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// IntegrationsStatuspageConnectionEntityPaginated - Integrations_Statuspage_ConnectionEntityPaginated model -type IntegrationsStatuspageConnectionEntityPaginated struct { - Data []IntegrationsStatuspageConnectionEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *IntegrationsStatuspageConnectionEntityPaginated) GetData() []IntegrationsStatuspageConnectionEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *IntegrationsStatuspageConnectionEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/integrationsstatuspagemilestonemappingentity.go b/internal/sdk/models/shared/integrationsstatuspagemilestonemappingentity.go deleted file mode 100644 index aef95bb..0000000 --- a/internal/sdk/models/shared/integrationsstatuspagemilestonemappingentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IntegrationsStatuspageMilestoneMappingEntity struct { - MilestoneID *string `json:"milestone_id,omitempty"` - Status *string `json:"status,omitempty"` -} - -func (o *IntegrationsStatuspageMilestoneMappingEntity) GetMilestoneID() *string { - if o == nil { - return nil - } - return o.MilestoneID -} - -func (o *IntegrationsStatuspageMilestoneMappingEntity) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} diff --git a/internal/sdk/models/shared/integrationsstatuspageseverityentity.go b/internal/sdk/models/shared/integrationsstatuspageseverityentity.go deleted file mode 100644 index 2be47b0..0000000 --- a/internal/sdk/models/shared/integrationsstatuspageseverityentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type IntegrationsStatuspageSeverityEntity struct { - SeveritySlug *string `json:"severity_slug,omitempty"` - RemoteStatus *string `json:"remote_status,omitempty"` -} - -func (o *IntegrationsStatuspageSeverityEntity) GetSeveritySlug() *string { - if o == nil { - return nil - } - return o.SeveritySlug -} - -func (o *IntegrationsStatuspageSeverityEntity) GetRemoteStatus() *string { - if o == nil { - return nil - } - return o.RemoteStatus -} diff --git a/internal/sdk/models/shared/lifecyclesmilestoneentity.go b/internal/sdk/models/shared/lifecyclesmilestoneentity.go deleted file mode 100644 index dfddac4..0000000 --- a/internal/sdk/models/shared/lifecyclesmilestoneentity.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type LifecyclesMilestoneEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Slug *string `json:"slug,omitempty"` - Position *int `json:"position,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - UpdatedBy *AuthorEntity `json:"updated_by,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (l LifecyclesMilestoneEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(l, "", false) -} - -func (l *LifecyclesMilestoneEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { - return err - } - return nil -} - -func (o *LifecyclesMilestoneEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *LifecyclesMilestoneEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *LifecyclesMilestoneEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *LifecyclesMilestoneEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *LifecyclesMilestoneEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *LifecyclesMilestoneEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *LifecyclesMilestoneEntity) GetUpdatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.UpdatedBy -} - -func (o *LifecyclesMilestoneEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *LifecyclesMilestoneEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} diff --git a/internal/sdk/models/shared/lifecyclesphaseentity.go b/internal/sdk/models/shared/lifecyclesphaseentity.go deleted file mode 100644 index 196bc49..0000000 --- a/internal/sdk/models/shared/lifecyclesphaseentity.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// LifecyclesPhaseEntity - Lifecycles_PhaseEntity model -type LifecyclesPhaseEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - Position *int `json:"position,omitempty"` - Milestones []LifecyclesMilestoneEntity `json:"milestones,omitempty"` -} - -func (o *LifecyclesPhaseEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *LifecyclesPhaseEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *LifecyclesPhaseEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *LifecyclesPhaseEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *LifecyclesPhaseEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *LifecyclesPhaseEntity) GetMilestones() []LifecyclesMilestoneEntity { - if o == nil { - return nil - } - return o.Milestones -} diff --git a/internal/sdk/models/shared/lifecyclesphaseentitylist.go b/internal/sdk/models/shared/lifecyclesphaseentitylist.go deleted file mode 100644 index 0a392f0..0000000 --- a/internal/sdk/models/shared/lifecyclesphaseentitylist.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// LifecyclesPhaseEntityList - Lifecycles_PhaseEntityList model -type LifecyclesPhaseEntityList struct { - Data []LifecyclesPhaseEntity `json:"data,omitempty"` -} - -func (o *LifecyclesPhaseEntityList) GetData() []LifecyclesPhaseEntity { - if o == nil { - return nil - } - return o.Data -} diff --git a/internal/sdk/models/shared/linksentity.go b/internal/sdk/models/shared/linksentity.go deleted file mode 100644 index 0a08c65..0000000 --- a/internal/sdk/models/shared/linksentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type LinksEntity struct { - ID *string `json:"id,omitempty"` - HrefURL *string `json:"href_url,omitempty"` - IconURL *string `json:"icon_url,omitempty"` - Name *string `json:"name,omitempty"` -} - -func (o *LinksEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *LinksEntity) GetHrefURL() *string { - if o == nil { - return nil - } - return o.HrefURL -} - -func (o *LinksEntity) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -func (o *LinksEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/mediaimageentity.go b/internal/sdk/models/shared/mediaimageentity.go deleted file mode 100644 index 93792c7..0000000 --- a/internal/sdk/models/shared/mediaimageentity.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// VersionsUrls - An object with keys that can have different versions of an image -type VersionsUrls struct { -} - -type MediaImageEntity struct { - OriginalURL *string `json:"original_url,omitempty"` - // An object with keys that can have different versions of an image - VersionsUrls *VersionsUrls `json:"versions_urls,omitempty"` -} - -func (o *MediaImageEntity) GetOriginalURL() *string { - if o == nil { - return nil - } - return o.OriginalURL -} - -func (o *MediaImageEntity) GetVersionsUrls() *VersionsUrls { - if o == nil { - return nil - } - return o.VersionsUrls -} diff --git a/internal/sdk/models/shared/membershipentity.go b/internal/sdk/models/shared/membershipentity.go deleted file mode 100644 index 9425216..0000000 --- a/internal/sdk/models/shared/membershipentity.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MembershipEntity struct { - User *UserEntity `json:"user,omitempty"` - Schedule *ScheduleEntity `json:"schedule,omitempty"` - // IncidentRoleEntity model - DefaultIncidentRole *IncidentRoleEntity `json:"default_incident_role,omitempty"` -} - -func (o *MembershipEntity) GetUser() *UserEntity { - if o == nil { - return nil - } - return o.User -} - -func (o *MembershipEntity) GetSchedule() *ScheduleEntity { - if o == nil { - return nil - } - return o.Schedule -} - -func (o *MembershipEntity) GetDefaultIncidentRole() *IncidentRoleEntity { - if o == nil { - return nil - } - return o.DefaultIncidentRole -} diff --git a/internal/sdk/models/shared/metricsinfrastructurelistentity.go b/internal/sdk/models/shared/metricsinfrastructurelistentity.go deleted file mode 100644 index a2d061f..0000000 --- a/internal/sdk/models/shared/metricsinfrastructurelistentity.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// MetricsInfrastructureListEntity - Metrics_InfrastructureListEntity model -type MetricsInfrastructureListEntity struct { - // List of infrastructure metrics - Data []MetricsInfrastructureMetricsEntity `json:"data,omitempty"` -} - -func (o *MetricsInfrastructureListEntity) GetData() []MetricsInfrastructureMetricsEntity { - if o == nil { - return nil - } - return o.Data -} diff --git a/internal/sdk/models/shared/metricsinfrastructuremetricsentity.go b/internal/sdk/models/shared/metricsinfrastructuremetricsentity.go deleted file mode 100644 index a29ef8c..0000000 --- a/internal/sdk/models/shared/metricsinfrastructuremetricsentity.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// MetricsInfrastructureMetricsEntity - Metrics_InfrastructureMetricsEntity model -type MetricsInfrastructureMetricsEntity struct { - // The UUID of the component - ID *string `json:"id,omitempty"` - // The name of the component - Name *string `json:"name,omitempty"` - // Mean Time To Detection (seconds) for all incidents for this component in this time period - Mttd *int `json:"mttd,omitempty"` - // Mean Time To Acknowledgement (seconds) for all incidents for this component in this time period - Mtta *int `json:"mtta,omitempty"` - // Mean Time To Mitigation (seconds) for all incidents for this component in this time period - Mttm *int `json:"mttm,omitempty"` - // Mean Time To Resolution (seconds) for all incidents for this component in this time period - Mttr *int `json:"mttr,omitempty"` - // Number of incidents in this time period for this component - Count *int `json:"count,omitempty"` - // Total time (seconds) the component was impacted (MTTR x Incident Count) - TotalTime *int `json:"total_time,omitempty"` -} - -func (o *MetricsInfrastructureMetricsEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *MetricsInfrastructureMetricsEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *MetricsInfrastructureMetricsEntity) GetMttd() *int { - if o == nil { - return nil - } - return o.Mttd -} - -func (o *MetricsInfrastructureMetricsEntity) GetMtta() *int { - if o == nil { - return nil - } - return o.Mtta -} - -func (o *MetricsInfrastructureMetricsEntity) GetMttm() *int { - if o == nil { - return nil - } - return o.Mttm -} - -func (o *MetricsInfrastructureMetricsEntity) GetMttr() *int { - if o == nil { - return nil - } - return o.Mttr -} - -func (o *MetricsInfrastructureMetricsEntity) GetCount() *int { - if o == nil { - return nil - } - return o.Count -} - -func (o *MetricsInfrastructureMetricsEntity) GetTotalTime() *int { - if o == nil { - return nil - } - return o.TotalTime -} diff --git a/internal/sdk/models/shared/metricsmetricsentity.go b/internal/sdk/models/shared/metricsmetricsentity.go deleted file mode 100644 index 90aad00..0000000 --- a/internal/sdk/models/shared/metricsmetricsentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type DisplayInformation struct { -} - -type Buckets struct { -} - -// MetricsMetricsEntity - Metrics_MetricsEntity model -type MetricsMetricsEntity struct { - Type *string `json:"type,omitempty"` - // The field by which the metrics are grouped. Can be one of: total, severity, priority, functionality, service, environment, or user. - By *string `json:"by,omitempty"` - // The size of returned buckets. Can be one of: day, week, month, or all_time. - BucketSize *int `json:"bucket_size,omitempty"` - DisplayInformation *DisplayInformation `json:"display_information,omitempty"` - Keys []string `json:"keys,omitempty"` - Buckets []Buckets `json:"buckets,omitempty"` - Sort *MetricsMetricsEntitySortEntity `json:"sort,omitempty"` -} - -func (o *MetricsMetricsEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *MetricsMetricsEntity) GetBy() *string { - if o == nil { - return nil - } - return o.By -} - -func (o *MetricsMetricsEntity) GetBucketSize() *int { - if o == nil { - return nil - } - return o.BucketSize -} - -func (o *MetricsMetricsEntity) GetDisplayInformation() *DisplayInformation { - if o == nil { - return nil - } - return o.DisplayInformation -} - -func (o *MetricsMetricsEntity) GetKeys() []string { - if o == nil { - return nil - } - return o.Keys -} - -func (o *MetricsMetricsEntity) GetBuckets() []Buckets { - if o == nil { - return nil - } - return o.Buckets -} - -func (o *MetricsMetricsEntity) GetSort() *MetricsMetricsEntitySortEntity { - if o == nil { - return nil - } - return o.Sort -} diff --git a/internal/sdk/models/shared/metricsmetricsentitysortentity.go b/internal/sdk/models/shared/metricsmetricsentitysortentity.go deleted file mode 100644 index 4dd7ce5..0000000 --- a/internal/sdk/models/shared/metricsmetricsentitysortentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsMetricsEntitySortEntity struct { - Field *string `json:"field,omitempty"` - Direction *string `json:"direction,omitempty"` - Limit *int `json:"limit,omitempty"` -} - -func (o *MetricsMetricsEntitySortEntity) GetField() *string { - if o == nil { - return nil - } - return o.Field -} - -func (o *MetricsMetricsEntitySortEntity) GetDirection() *string { - if o == nil { - return nil - } - return o.Direction -} - -func (o *MetricsMetricsEntitySortEntity) GetLimit() *int { - if o == nil { - return nil - } - return o.Limit -} diff --git a/internal/sdk/models/shared/metricsmilestonesfunnelentity.go b/internal/sdk/models/shared/metricsmilestonesfunnelentity.go deleted file mode 100644 index 90b0011..0000000 --- a/internal/sdk/models/shared/metricsmilestonesfunnelentity.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// MetricsMilestonesFunnelEntity - Metrics_MilestonesFunnelEntity model -type MetricsMilestonesFunnelEntity struct { - Data []MetricsMilestonesFunnelEntityDataBucketEntity `json:"data,omitempty"` - Columns []MetricsMilestonesFunnelEntityColumnEntity `json:"columns,omitempty"` - Groupings *MetricsMilestonesFunnelEntityGroupingsEntity `json:"groupings,omitempty"` - Meta *MetricsMilestonesFunnelEntityMetaEntity `json:"meta,omitempty"` -} - -func (o *MetricsMilestonesFunnelEntity) GetData() []MetricsMilestonesFunnelEntityDataBucketEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *MetricsMilestonesFunnelEntity) GetColumns() []MetricsMilestonesFunnelEntityColumnEntity { - if o == nil { - return nil - } - return o.Columns -} - -func (o *MetricsMilestonesFunnelEntity) GetGroupings() *MetricsMilestonesFunnelEntityGroupingsEntity { - if o == nil { - return nil - } - return o.Groupings -} - -func (o *MetricsMilestonesFunnelEntity) GetMeta() *MetricsMilestonesFunnelEntityMetaEntity { - if o == nil { - return nil - } - return o.Meta -} diff --git a/internal/sdk/models/shared/metricsmilestonesfunnelentitycolumnentity.go b/internal/sdk/models/shared/metricsmilestonesfunnelentitycolumnentity.go deleted file mode 100644 index bcec412..0000000 --- a/internal/sdk/models/shared/metricsmilestonesfunnelentitycolumnentity.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsMilestonesFunnelEntityColumnEntity struct { - // The slug of the milestone - Name *string `json:"name,omitempty"` - // The name of the milestone - Label *string `json:"label,omitempty"` - // The description of the milestone - Tooltip *string `json:"tooltip,omitempty"` - // The UUID of the milestone - ID *string `json:"id,omitempty"` -} - -func (o *MetricsMilestonesFunnelEntityColumnEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *MetricsMilestonesFunnelEntityColumnEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} - -func (o *MetricsMilestonesFunnelEntityColumnEntity) GetTooltip() *string { - if o == nil { - return nil - } - return o.Tooltip -} - -func (o *MetricsMilestonesFunnelEntityColumnEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} diff --git a/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketentity.go b/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketentity.go deleted file mode 100644 index c4d067e..0000000 --- a/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketentity.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type MetricsMilestonesFunnelEntityDataBucketEntity struct { - // The start datetime for the period - TimeBucket *time.Time `json:"time_bucket,omitempty"` - FilterParams *MetricsMilestonesFunnelEntityDataBucketFilterParamsEntity `json:"filter_params,omitempty"` - MilestoneCounts []MetricsMilestonesFunnelEntityDataBucketMilestoneCountEntity `json:"milestone_counts,omitempty"` -} - -func (m MetricsMilestonesFunnelEntityDataBucketEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(m, "", false) -} - -func (m *MetricsMilestonesFunnelEntityDataBucketEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil { - return err - } - return nil -} - -func (o *MetricsMilestonesFunnelEntityDataBucketEntity) GetTimeBucket() *time.Time { - if o == nil { - return nil - } - return o.TimeBucket -} - -func (o *MetricsMilestonesFunnelEntityDataBucketEntity) GetFilterParams() *MetricsMilestonesFunnelEntityDataBucketFilterParamsEntity { - if o == nil { - return nil - } - return o.FilterParams -} - -func (o *MetricsMilestonesFunnelEntityDataBucketEntity) GetMilestoneCounts() []MetricsMilestonesFunnelEntityDataBucketMilestoneCountEntity { - if o == nil { - return nil - } - return o.MilestoneCounts -} diff --git a/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketfilterparamsentity.go b/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketfilterparamsentity.go deleted file mode 100644 index 81a99ba..0000000 --- a/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketfilterparamsentity.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "time" -) - -type MetricsMilestonesFunnelEntityDataBucketFilterParamsEntity struct { - // The start datetime for the period - StartDate *time.Time `json:"start_date,omitempty"` - // The end datetime for the period not inclusive - EndDate *types.Date `json:"end_date,omitempty"` -} - -func (m MetricsMilestonesFunnelEntityDataBucketFilterParamsEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(m, "", false) -} - -func (m *MetricsMilestonesFunnelEntityDataBucketFilterParamsEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil { - return err - } - return nil -} - -func (o *MetricsMilestonesFunnelEntityDataBucketFilterParamsEntity) GetStartDate() *time.Time { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *MetricsMilestonesFunnelEntityDataBucketFilterParamsEntity) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} diff --git a/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketmilestonecountentity.go b/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketmilestonecountentity.go deleted file mode 100644 index 5f88eed..0000000 --- a/internal/sdk/models/shared/metricsmilestonesfunnelentitydatabucketmilestonecountentity.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsMilestonesFunnelEntityDataBucketMilestoneCountEntity struct { - // The UUID of the milestone - MilestoneID *string `json:"milestone_id,omitempty"` - // The frequency count of that milestone for the period - Count *int `json:"count,omitempty"` -} - -func (o *MetricsMilestonesFunnelEntityDataBucketMilestoneCountEntity) GetMilestoneID() *string { - if o == nil { - return nil - } - return o.MilestoneID -} - -func (o *MetricsMilestonesFunnelEntityDataBucketMilestoneCountEntity) GetCount() *int { - if o == nil { - return nil - } - return o.Count -} diff --git a/internal/sdk/models/shared/metricsmilestonesfunnelentitygroupingsentity.go b/internal/sdk/models/shared/metricsmilestonesfunnelentitygroupingsentity.go deleted file mode 100644 index 007f142..0000000 --- a/internal/sdk/models/shared/metricsmilestonesfunnelentitygroupingsentity.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsMilestonesFunnelEntityGroupingsEntity struct { - // The bucket size for the data - BucketSize *string `json:"bucket_size,omitempty"` -} - -func (o *MetricsMilestonesFunnelEntityGroupingsEntity) GetBucketSize() *string { - if o == nil { - return nil - } - return o.BucketSize -} diff --git a/internal/sdk/models/shared/metricsmilestonesfunnelentitymetaentity.go b/internal/sdk/models/shared/metricsmilestonesfunnelentitymetaentity.go deleted file mode 100644 index d2dd2af..0000000 --- a/internal/sdk/models/shared/metricsmilestonesfunnelentitymetaentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsMilestonesFunnelEntityMetaEntity struct { - DeletedMilestones []string `json:"deleted_milestones,omitempty"` - AddedMilestones []string `json:"added_milestones,omitempty"` -} - -func (o *MetricsMilestonesFunnelEntityMetaEntity) GetDeletedMilestones() []string { - if o == nil { - return nil - } - return o.DeletedMilestones -} - -func (o *MetricsMilestonesFunnelEntityMetaEntity) GetAddedMilestones() []string { - if o == nil { - return nil - } - return o.AddedMilestones -} diff --git a/internal/sdk/models/shared/metricsmttxdataentity.go b/internal/sdk/models/shared/metricsmttxdataentity.go deleted file mode 100644 index f95926c..0000000 --- a/internal/sdk/models/shared/metricsmttxdataentity.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// MetricsMttxDataEntity - Metrics_MttxDataEntity model -type MetricsMttxDataEntity struct { - Groupings []MetricsMttxDataEntityGroupingEntity `json:"groupings,omitempty"` - Data []MetricsMttxGroupEntity `json:"data,omitempty"` -} - -func (o *MetricsMttxDataEntity) GetGroupings() []MetricsMttxDataEntityGroupingEntity { - if o == nil { - return nil - } - return o.Groupings -} - -func (o *MetricsMttxDataEntity) GetData() []MetricsMttxGroupEntity { - if o == nil { - return nil - } - return o.Data -} diff --git a/internal/sdk/models/shared/metricsmttxdataentitygroupingentity.go b/internal/sdk/models/shared/metricsmttxdataentitygroupingentity.go deleted file mode 100644 index 83d7620..0000000 --- a/internal/sdk/models/shared/metricsmttxdataentitygroupingentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsMttxDataEntityGroupingEntity struct { - Type *string `json:"type,omitempty"` - IDAttribute *string `json:"id_attribute,omitempty"` - NameAttribute *string `json:"name_attribute,omitempty"` -} - -func (o *MetricsMttxDataEntityGroupingEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *MetricsMttxDataEntityGroupingEntity) GetIDAttribute() *string { - if o == nil { - return nil - } - return o.IDAttribute -} - -func (o *MetricsMttxDataEntityGroupingEntity) GetNameAttribute() *string { - if o == nil { - return nil - } - return o.NameAttribute -} diff --git a/internal/sdk/models/shared/metricsmttxgroupentity.go b/internal/sdk/models/shared/metricsmttxgroupentity.go deleted file mode 100644 index 884b9a4..0000000 --- a/internal/sdk/models/shared/metricsmttxgroupentity.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type FilterParams struct { -} - -type MetricsMttxGroupEntity struct { - GroupAttributes *string `json:"group_attributes,omitempty"` - FilterParams *FilterParams `json:"filter_params,omitempty"` - Count *int `json:"count,omitempty"` - Mttd *float32 `json:"mttd,omitempty"` - Mtta *float32 `json:"mtta,omitempty"` - Mttm *float32 `json:"mttm,omitempty"` - Mttr *float32 `json:"mttr,omitempty"` - CountDiff *int `json:"count_diff,omitempty"` - CountPercentDiff *float32 `json:"count_percent_diff,omitempty"` - MttdDiff *float32 `json:"mttd_diff,omitempty"` - MttaDiff *float32 `json:"mtta_diff,omitempty"` - MttmDiff *float32 `json:"mttm_diff,omitempty"` - MttrDiff *float32 `json:"mttr_diff,omitempty"` - MttdPercentDiff *float32 `json:"mttd_percent_diff,omitempty"` - MttaPercentDiff *float32 `json:"mtta_percent_diff,omitempty"` - MttmPercentDiff *float32 `json:"mttm_percent_diff,omitempty"` - MttrPercentDiff *float32 `json:"mttr_percent_diff,omitempty"` - Healthiness *float32 `json:"healthiness,omitempty"` -} - -func (o *MetricsMttxGroupEntity) GetGroupAttributes() *string { - if o == nil { - return nil - } - return o.GroupAttributes -} - -func (o *MetricsMttxGroupEntity) GetFilterParams() *FilterParams { - if o == nil { - return nil - } - return o.FilterParams -} - -func (o *MetricsMttxGroupEntity) GetCount() *int { - if o == nil { - return nil - } - return o.Count -} - -func (o *MetricsMttxGroupEntity) GetMttd() *float32 { - if o == nil { - return nil - } - return o.Mttd -} - -func (o *MetricsMttxGroupEntity) GetMtta() *float32 { - if o == nil { - return nil - } - return o.Mtta -} - -func (o *MetricsMttxGroupEntity) GetMttm() *float32 { - if o == nil { - return nil - } - return o.Mttm -} - -func (o *MetricsMttxGroupEntity) GetMttr() *float32 { - if o == nil { - return nil - } - return o.Mttr -} - -func (o *MetricsMttxGroupEntity) GetCountDiff() *int { - if o == nil { - return nil - } - return o.CountDiff -} - -func (o *MetricsMttxGroupEntity) GetCountPercentDiff() *float32 { - if o == nil { - return nil - } - return o.CountPercentDiff -} - -func (o *MetricsMttxGroupEntity) GetMttdDiff() *float32 { - if o == nil { - return nil - } - return o.MttdDiff -} - -func (o *MetricsMttxGroupEntity) GetMttaDiff() *float32 { - if o == nil { - return nil - } - return o.MttaDiff -} - -func (o *MetricsMttxGroupEntity) GetMttmDiff() *float32 { - if o == nil { - return nil - } - return o.MttmDiff -} - -func (o *MetricsMttxGroupEntity) GetMttrDiff() *float32 { - if o == nil { - return nil - } - return o.MttrDiff -} - -func (o *MetricsMttxGroupEntity) GetMttdPercentDiff() *float32 { - if o == nil { - return nil - } - return o.MttdPercentDiff -} - -func (o *MetricsMttxGroupEntity) GetMttaPercentDiff() *float32 { - if o == nil { - return nil - } - return o.MttaPercentDiff -} - -func (o *MetricsMttxGroupEntity) GetMttmPercentDiff() *float32 { - if o == nil { - return nil - } - return o.MttmPercentDiff -} - -func (o *MetricsMttxGroupEntity) GetMttrPercentDiff() *float32 { - if o == nil { - return nil - } - return o.MttrPercentDiff -} - -func (o *MetricsMttxGroupEntity) GetHealthiness() *float32 { - if o == nil { - return nil - } - return o.Healthiness -} diff --git a/internal/sdk/models/shared/metricsretrospectiveentity.go b/internal/sdk/models/shared/metricsretrospectiveentity.go deleted file mode 100644 index da29fde..0000000 --- a/internal/sdk/models/shared/metricsretrospectiveentity.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// MetricsRetrospectiveEntity - Metrics_RetrospectiveEntity model -type MetricsRetrospectiveEntity struct { - Data []MetricsRetrospectiveEntityDataEntity `json:"data,omitempty"` - Summary *MetricsRetrospectiveEntitySummaryEntity `json:"summary,omitempty"` -} - -func (o *MetricsRetrospectiveEntity) GetData() []MetricsRetrospectiveEntityDataEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *MetricsRetrospectiveEntity) GetSummary() *MetricsRetrospectiveEntitySummaryEntity { - if o == nil { - return nil - } - return o.Summary -} diff --git a/internal/sdk/models/shared/metricsretrospectiveentitydataentity.go b/internal/sdk/models/shared/metricsretrospectiveentitydataentity.go deleted file mode 100644 index 73a8f17..0000000 --- a/internal/sdk/models/shared/metricsretrospectiveentitydataentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsRetrospectiveEntityDataEntity struct { - X *string `json:"x,omitempty"` - Y *float32 `json:"y,omitempty"` -} - -func (o *MetricsRetrospectiveEntityDataEntity) GetX() *string { - if o == nil { - return nil - } - return o.X -} - -func (o *MetricsRetrospectiveEntityDataEntity) GetY() *float32 { - if o == nil { - return nil - } - return o.Y -} diff --git a/internal/sdk/models/shared/metricsretrospectiveentitysummaryentity.go b/internal/sdk/models/shared/metricsretrospectiveentitysummaryentity.go deleted file mode 100644 index a51461f..0000000 --- a/internal/sdk/models/shared/metricsretrospectiveentitysummaryentity.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsRetrospectiveEntitySummaryEntity struct { - Completed *int `json:"completed,omitempty"` - Total *int `json:"total,omitempty"` - Incomplete *int `json:"incomplete,omitempty"` - Mean *float32 `json:"mean,omitempty"` - Shortest *float32 `json:"shortest,omitempty"` - Longest *float32 `json:"longest,omitempty"` - CompletionPercentage *float32 `json:"completion_percentage,omitempty"` -} - -func (o *MetricsRetrospectiveEntitySummaryEntity) GetCompleted() *int { - if o == nil { - return nil - } - return o.Completed -} - -func (o *MetricsRetrospectiveEntitySummaryEntity) GetTotal() *int { - if o == nil { - return nil - } - return o.Total -} - -func (o *MetricsRetrospectiveEntitySummaryEntity) GetIncomplete() *int { - if o == nil { - return nil - } - return o.Incomplete -} - -func (o *MetricsRetrospectiveEntitySummaryEntity) GetMean() *float32 { - if o == nil { - return nil - } - return o.Mean -} - -func (o *MetricsRetrospectiveEntitySummaryEntity) GetShortest() *float32 { - if o == nil { - return nil - } - return o.Shortest -} - -func (o *MetricsRetrospectiveEntitySummaryEntity) GetLongest() *float32 { - if o == nil { - return nil - } - return o.Longest -} - -func (o *MetricsRetrospectiveEntitySummaryEntity) GetCompletionPercentage() *float32 { - if o == nil { - return nil - } - return o.CompletionPercentage -} diff --git a/internal/sdk/models/shared/metricsticketfunnelmetricsentity.go b/internal/sdk/models/shared/metricsticketfunnelmetricsentity.go deleted file mode 100644 index 6928929..0000000 --- a/internal/sdk/models/shared/metricsticketfunnelmetricsentity.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// MetricsTicketFunnelMetricsEntity - Metrics_TicketFunnelMetricsEntity model -type MetricsTicketFunnelMetricsEntity struct { - Data []MetricsTicketFunnelMetricsEntityDataBucketEntity `json:"data,omitempty"` - Groupings *MetricsTicketFunnelMetricsEntityGroupingsEntity `json:"groupings,omitempty"` -} - -func (o *MetricsTicketFunnelMetricsEntity) GetData() []MetricsTicketFunnelMetricsEntityDataBucketEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *MetricsTicketFunnelMetricsEntity) GetGroupings() *MetricsTicketFunnelMetricsEntityGroupingsEntity { - if o == nil { - return nil - } - return o.Groupings -} diff --git a/internal/sdk/models/shared/metricsticketfunnelmetricsentitydatabucketentity.go b/internal/sdk/models/shared/metricsticketfunnelmetricsentitydatabucketentity.go deleted file mode 100644 index 8ed0f42..0000000 --- a/internal/sdk/models/shared/metricsticketfunnelmetricsentitydatabucketentity.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type MetricsTicketFunnelMetricsEntityDataBucketEntity struct { - // The start datetime for the period - TimeBucket *time.Time `json:"time_bucket,omitempty"` - FilterParams *MetricsTicketFunnelMetricsEntityDataBucketFilterParamsEntity `json:"filter_params,omitempty"` - // The number of tasks created - TasksCreated *int `json:"tasks_created,omitempty"` - // The number of tasks completed - TasksDone *int `json:"tasks_done,omitempty"` - // The number of follow ups created - FollowUpsCreated *int `json:"follow_ups_created,omitempty"` - // The number of follow ups completed - FollowUpsDone *int `json:"follow_ups_done,omitempty"` -} - -func (m MetricsTicketFunnelMetricsEntityDataBucketEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(m, "", false) -} - -func (m *MetricsTicketFunnelMetricsEntityDataBucketEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil { - return err - } - return nil -} - -func (o *MetricsTicketFunnelMetricsEntityDataBucketEntity) GetTimeBucket() *time.Time { - if o == nil { - return nil - } - return o.TimeBucket -} - -func (o *MetricsTicketFunnelMetricsEntityDataBucketEntity) GetFilterParams() *MetricsTicketFunnelMetricsEntityDataBucketFilterParamsEntity { - if o == nil { - return nil - } - return o.FilterParams -} - -func (o *MetricsTicketFunnelMetricsEntityDataBucketEntity) GetTasksCreated() *int { - if o == nil { - return nil - } - return o.TasksCreated -} - -func (o *MetricsTicketFunnelMetricsEntityDataBucketEntity) GetTasksDone() *int { - if o == nil { - return nil - } - return o.TasksDone -} - -func (o *MetricsTicketFunnelMetricsEntityDataBucketEntity) GetFollowUpsCreated() *int { - if o == nil { - return nil - } - return o.FollowUpsCreated -} - -func (o *MetricsTicketFunnelMetricsEntityDataBucketEntity) GetFollowUpsDone() *int { - if o == nil { - return nil - } - return o.FollowUpsDone -} diff --git a/internal/sdk/models/shared/metricsticketfunnelmetricsentitydatabucketfilterparamsentity.go b/internal/sdk/models/shared/metricsticketfunnelmetricsentitydatabucketfilterparamsentity.go deleted file mode 100644 index 9902ec4..0000000 --- a/internal/sdk/models/shared/metricsticketfunnelmetricsentitydatabucketfilterparamsentity.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" - "time" -) - -type MetricsTicketFunnelMetricsEntityDataBucketFilterParamsEntity struct { - // The start datetime for the period - StartDate *time.Time `json:"start_date,omitempty"` - // The end datetime for the period not inclusive - EndDate *types.Date `json:"end_date,omitempty"` -} - -func (m MetricsTicketFunnelMetricsEntityDataBucketFilterParamsEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(m, "", false) -} - -func (m *MetricsTicketFunnelMetricsEntityDataBucketFilterParamsEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil { - return err - } - return nil -} - -func (o *MetricsTicketFunnelMetricsEntityDataBucketFilterParamsEntity) GetStartDate() *time.Time { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *MetricsTicketFunnelMetricsEntityDataBucketFilterParamsEntity) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} diff --git a/internal/sdk/models/shared/metricsticketfunnelmetricsentitygroupingsentity.go b/internal/sdk/models/shared/metricsticketfunnelmetricsentitygroupingsentity.go deleted file mode 100644 index e990b05..0000000 --- a/internal/sdk/models/shared/metricsticketfunnelmetricsentitygroupingsentity.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type MetricsTicketFunnelMetricsEntityGroupingsEntity struct { - // The bucket size for the data - BucketSize *string `json:"bucket_size,omitempty"` -} - -func (o *MetricsTicketFunnelMetricsEntityGroupingsEntity) GetBucketSize() *string { - if o == nil { - return nil - } - return o.BucketSize -} diff --git a/internal/sdk/models/shared/nunccomponententity.go b/internal/sdk/models/shared/nunccomponententity.go deleted file mode 100644 index e571cb8..0000000 --- a/internal/sdk/models/shared/nunccomponententity.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type NuncComponentEntity struct { - InfrastructureType *string `json:"infrastructure_type,omitempty"` - InfrastructureID *string `json:"infrastructure_id,omitempty"` - Label *string `json:"label,omitempty"` - Position *int `json:"position,omitempty"` - ComponentGroupID *string `json:"component_group_id,omitempty"` -} - -func (o *NuncComponentEntity) GetInfrastructureType() *string { - if o == nil { - return nil - } - return o.InfrastructureType -} - -func (o *NuncComponentEntity) GetInfrastructureID() *string { - if o == nil { - return nil - } - return o.InfrastructureID -} - -func (o *NuncComponentEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} - -func (o *NuncComponentEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *NuncComponentEntity) GetComponentGroupID() *string { - if o == nil { - return nil - } - return o.ComponentGroupID -} diff --git a/internal/sdk/models/shared/nunccomponentgroupentity.go b/internal/sdk/models/shared/nunccomponentgroupentity.go deleted file mode 100644 index 7d58fd8..0000000 --- a/internal/sdk/models/shared/nunccomponentgroupentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type NuncComponentGroupEntity struct { - ID *string `json:"id,omitempty"` - ComponentGroupID *string `json:"component_group_id,omitempty"` - Name *string `json:"name,omitempty"` - Position *int `json:"position,omitempty"` -} - -func (o *NuncComponentGroupEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *NuncComponentGroupEntity) GetComponentGroupID() *string { - if o == nil { - return nil - } - return o.ComponentGroupID -} - -func (o *NuncComponentGroupEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *NuncComponentGroupEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/nuncconditionentity.go b/internal/sdk/models/shared/nuncconditionentity.go deleted file mode 100644 index 9885883..0000000 --- a/internal/sdk/models/shared/nuncconditionentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type NuncConditionEntity struct { - NuncCondition *string `json:"nunc_condition,omitempty"` - ConditionName *string `json:"condition_name,omitempty"` - ConditionID *string `json:"condition_id,omitempty"` -} - -func (o *NuncConditionEntity) GetNuncCondition() *string { - if o == nil { - return nil - } - return o.NuncCondition -} - -func (o *NuncConditionEntity) GetConditionName() *string { - if o == nil { - return nil - } - return o.ConditionName -} - -func (o *NuncConditionEntity) GetConditionID() *string { - if o == nil { - return nil - } - return o.ConditionID -} diff --git a/internal/sdk/models/shared/nuncconnectionentity.go b/internal/sdk/models/shared/nuncconnectionentity.go deleted file mode 100644 index d3d4b28..0000000 --- a/internal/sdk/models/shared/nuncconnectionentity.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// NuncConnectionEntity model -type NuncConnectionEntity struct { - ID *string `json:"id,omitempty"` - Domain *string `json:"domain,omitempty"` - CompanyName *string `json:"company_name,omitempty"` - CompanyWebsite *string `json:"company_website,omitempty"` - Cname *string `json:"cname,omitempty"` - GreetingTitle *string `json:"greeting_title,omitempty"` - GreetingBody *string `json:"greeting_body,omitempty"` - OperationalMessage *string `json:"operational_message,omitempty"` - CompanyTosURL *string `json:"company_tos_url,omitempty"` - PrimaryColor *string `json:"primary_color,omitempty"` - SecondaryColor *string `json:"secondary_color,omitempty"` - ButtonBackgroundColor *string `json:"button_background_color,omitempty"` - ButtonTextColor *string `json:"button_text_color,omitempty"` - LinkColor *string `json:"link_color,omitempty"` - Title *string `json:"title,omitempty"` - ExposedFields *string `json:"exposed_fields,omitempty"` - Conditions *NuncConditionEntity `json:"conditions,omitempty"` - Components *NuncComponentEntity `json:"components,omitempty"` - ComponentGroups *NuncComponentGroupEntity `json:"component_groups,omitempty"` - Logo *MediaImageEntity `json:"logo,omitempty"` - CoverImage *MediaImageEntity `json:"cover_image,omitempty"` - Favicon *MediaImageEntity `json:"favicon,omitempty"` - OpenGraphImage *MediaImageEntity `json:"open_graph_image,omitempty"` - DarkLogo *MediaImageEntity `json:"dark_logo,omitempty"` - EnableHistogram *bool `json:"enable_histogram,omitempty"` - UIVersion *int `json:"ui_version,omitempty"` - // List of links attached to this status page. - Links []LinksEntity `json:"links,omitempty"` -} - -func (o *NuncConnectionEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *NuncConnectionEntity) GetDomain() *string { - if o == nil { - return nil - } - return o.Domain -} - -func (o *NuncConnectionEntity) GetCompanyName() *string { - if o == nil { - return nil - } - return o.CompanyName -} - -func (o *NuncConnectionEntity) GetCompanyWebsite() *string { - if o == nil { - return nil - } - return o.CompanyWebsite -} - -func (o *NuncConnectionEntity) GetCname() *string { - if o == nil { - return nil - } - return o.Cname -} - -func (o *NuncConnectionEntity) GetGreetingTitle() *string { - if o == nil { - return nil - } - return o.GreetingTitle -} - -func (o *NuncConnectionEntity) GetGreetingBody() *string { - if o == nil { - return nil - } - return o.GreetingBody -} - -func (o *NuncConnectionEntity) GetOperationalMessage() *string { - if o == nil { - return nil - } - return o.OperationalMessage -} - -func (o *NuncConnectionEntity) GetCompanyTosURL() *string { - if o == nil { - return nil - } - return o.CompanyTosURL -} - -func (o *NuncConnectionEntity) GetPrimaryColor() *string { - if o == nil { - return nil - } - return o.PrimaryColor -} - -func (o *NuncConnectionEntity) GetSecondaryColor() *string { - if o == nil { - return nil - } - return o.SecondaryColor -} - -func (o *NuncConnectionEntity) GetButtonBackgroundColor() *string { - if o == nil { - return nil - } - return o.ButtonBackgroundColor -} - -func (o *NuncConnectionEntity) GetButtonTextColor() *string { - if o == nil { - return nil - } - return o.ButtonTextColor -} - -func (o *NuncConnectionEntity) GetLinkColor() *string { - if o == nil { - return nil - } - return o.LinkColor -} - -func (o *NuncConnectionEntity) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *NuncConnectionEntity) GetExposedFields() *string { - if o == nil { - return nil - } - return o.ExposedFields -} - -func (o *NuncConnectionEntity) GetConditions() *NuncConditionEntity { - if o == nil { - return nil - } - return o.Conditions -} - -func (o *NuncConnectionEntity) GetComponents() *NuncComponentEntity { - if o == nil { - return nil - } - return o.Components -} - -func (o *NuncConnectionEntity) GetComponentGroups() *NuncComponentGroupEntity { - if o == nil { - return nil - } - return o.ComponentGroups -} - -func (o *NuncConnectionEntity) GetLogo() *MediaImageEntity { - if o == nil { - return nil - } - return o.Logo -} - -func (o *NuncConnectionEntity) GetCoverImage() *MediaImageEntity { - if o == nil { - return nil - } - return o.CoverImage -} - -func (o *NuncConnectionEntity) GetFavicon() *MediaImageEntity { - if o == nil { - return nil - } - return o.Favicon -} - -func (o *NuncConnectionEntity) GetOpenGraphImage() *MediaImageEntity { - if o == nil { - return nil - } - return o.OpenGraphImage -} - -func (o *NuncConnectionEntity) GetDarkLogo() *MediaImageEntity { - if o == nil { - return nil - } - return o.DarkLogo -} - -func (o *NuncConnectionEntity) GetEnableHistogram() *bool { - if o == nil { - return nil - } - return o.EnableHistogram -} - -func (o *NuncConnectionEntity) GetUIVersion() *int { - if o == nil { - return nil - } - return o.UIVersion -} - -func (o *NuncConnectionEntity) GetLinks() []LinksEntity { - if o == nil { - return nil - } - return o.Links -} diff --git a/internal/sdk/models/shared/nuncconnectionentitypaginated.go b/internal/sdk/models/shared/nuncconnectionentitypaginated.go deleted file mode 100644 index e0bbb8a..0000000 --- a/internal/sdk/models/shared/nuncconnectionentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// NuncConnectionEntityPaginated model -type NuncConnectionEntityPaginated struct { - Data []NuncConnectionEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *NuncConnectionEntityPaginated) GetData() []NuncConnectionEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *NuncConnectionEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/nuncemailsubscribersentity.go b/internal/sdk/models/shared/nuncemailsubscribersentity.go deleted file mode 100644 index 600fdf7..0000000 --- a/internal/sdk/models/shared/nuncemailsubscribersentity.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// NuncEmailSubscribersEntity model -type NuncEmailSubscribersEntity struct { - // UUID of the subscriber - ID *string `json:"id,omitempty"` - // Email of the subscriber - Email *string `json:"email,omitempty"` - // The time the subscriber was created - CreatedAt *time.Time `json:"created_at,omitempty"` -} - -func (n NuncEmailSubscribersEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(n, "", false) -} - -func (n *NuncEmailSubscribersEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &n, "", false, false); err != nil { - return err - } - return nil -} - -func (o *NuncEmailSubscribersEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *NuncEmailSubscribersEntity) GetEmail() *string { - if o == nil { - return nil - } - return o.Email -} - -func (o *NuncEmailSubscribersEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} diff --git a/internal/sdk/models/shared/nuncnuncsubscription.go b/internal/sdk/models/shared/nuncnuncsubscription.go deleted file mode 100644 index 0a1fb32..0000000 --- a/internal/sdk/models/shared/nuncnuncsubscription.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// NuncNuncSubscription - Nunc_NuncSubscription model -type NuncNuncSubscription struct { - Response *string `json:"response,omitempty"` -} - -func (o *NuncNuncSubscription) GetResponse() *string { - if o == nil { - return nil - } - return o.Response -} diff --git a/internal/sdk/models/shared/organizationentity.go b/internal/sdk/models/shared/organizationentity.go deleted file mode 100644 index 43c2fd9..0000000 --- a/internal/sdk/models/shared/organizationentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type OrganizationEntity struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` -} - -func (o *OrganizationEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *OrganizationEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} diff --git a/internal/sdk/models/shared/organizationscustomfielddefinitionentity.go b/internal/sdk/models/shared/organizationscustomfielddefinitionentity.go deleted file mode 100644 index e83fab5..0000000 --- a/internal/sdk/models/shared/organizationscustomfielddefinitionentity.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// OrganizationsCustomFieldDefinitionEntity - Organizations_CustomFieldDefinitionEntity model -type OrganizationsCustomFieldDefinitionEntity struct { - DisplayName *string `json:"display_name,omitempty"` - FieldID *string `json:"field_id,omitempty"` - FieldType *string `json:"field_type,omitempty"` - Slug *string `json:"slug,omitempty"` - Description *string `json:"description,omitempty"` - Required *bool `json:"required,omitempty"` - // The milestone at which this field is required, if `required` is set to `true`. When null, a required field is always required. - RequiredAtMilestoneID *string `json:"required_at_milestone_id,omitempty"` - PermissibleValues *string `json:"permissible_values,omitempty"` -} - -func (o *OrganizationsCustomFieldDefinitionEntity) GetDisplayName() *string { - if o == nil { - return nil - } - return o.DisplayName -} - -func (o *OrganizationsCustomFieldDefinitionEntity) GetFieldID() *string { - if o == nil { - return nil - } - return o.FieldID -} - -func (o *OrganizationsCustomFieldDefinitionEntity) GetFieldType() *string { - if o == nil { - return nil - } - return o.FieldType -} - -func (o *OrganizationsCustomFieldDefinitionEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *OrganizationsCustomFieldDefinitionEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *OrganizationsCustomFieldDefinitionEntity) GetRequired() *bool { - if o == nil { - return nil - } - return o.Required -} - -func (o *OrganizationsCustomFieldDefinitionEntity) GetRequiredAtMilestoneID() *string { - if o == nil { - return nil - } - return o.RequiredAtMilestoneID -} - -func (o *OrganizationsCustomFieldDefinitionEntity) GetPermissibleValues() *string { - if o == nil { - return nil - } - return o.PermissibleValues -} diff --git a/internal/sdk/models/shared/paginationentity.go b/internal/sdk/models/shared/paginationentity.go deleted file mode 100644 index 24c824a..0000000 --- a/internal/sdk/models/shared/paginationentity.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PaginationEntity struct { - Count *int `json:"count,omitempty"` - Page *int `json:"page,omitempty"` - Items *int `json:"items,omitempty"` - Pages *int `json:"pages,omitempty"` - Last *int `json:"last,omitempty"` - Prev *int `json:"prev,omitempty"` - Next *int `json:"next,omitempty"` -} - -func (o *PaginationEntity) GetCount() *int { - if o == nil { - return nil - } - return o.Count -} - -func (o *PaginationEntity) GetPage() *int { - if o == nil { - return nil - } - return o.Page -} - -func (o *PaginationEntity) GetItems() *int { - if o == nil { - return nil - } - return o.Items -} - -func (o *PaginationEntity) GetPages() *int { - if o == nil { - return nil - } - return o.Pages -} - -func (o *PaginationEntity) GetLast() *int { - if o == nil { - return nil - } - return o.Last -} - -func (o *PaginationEntity) GetPrev() *int { - if o == nil { - return nil - } - return o.Prev -} - -func (o *PaginationEntity) GetNext() *int { - if o == nil { - return nil - } - return o.Next -} diff --git a/internal/sdk/models/shared/patchv1changeschangeid.go b/internal/sdk/models/shared/patchv1changeschangeid.go deleted file mode 100644 index b857325..0000000 --- a/internal/sdk/models/shared/patchv1changeschangeid.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1ChangesChangeID - Update a change entry -type PatchV1ChangesChangeID struct { - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - Labels map[string]string `json:"labels,omitempty"` -} - -func (o *PatchV1ChangesChangeID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PatchV1ChangesChangeID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1ChangesChangeID) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} diff --git a/internal/sdk/models/shared/patchv1changeschangeididentitiesidentityid.go b/internal/sdk/models/shared/patchv1changeschangeididentitiesidentityid.go deleted file mode 100644 index 692e80c..0000000 --- a/internal/sdk/models/shared/patchv1changeschangeididentitiesidentityid.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1ChangesChangeIDIdentitiesIdentityID - Update an identity -type PatchV1ChangesChangeIDIdentitiesIdentityID struct { - Type string `json:"type"` - Value string `json:"value"` -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityID) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *PatchV1ChangesChangeIDIdentitiesIdentityID) GetValue() string { - if o == nil { - return "" - } - return o.Value -} diff --git a/internal/sdk/models/shared/patchv1changeseventschangeeventid.go b/internal/sdk/models/shared/patchv1changeseventschangeeventid.go deleted file mode 100644 index 268e01f..0000000 --- a/internal/sdk/models/shared/patchv1changeseventschangeeventid.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type PatchV1ChangesEventsChangeEventIDType string - -const ( - PatchV1ChangesEventsChangeEventIDTypeLink PatchV1ChangesEventsChangeEventIDType = "link" -) - -func (e PatchV1ChangesEventsChangeEventIDType) ToPointer() *PatchV1ChangesEventsChangeEventIDType { - return &e -} -func (e *PatchV1ChangesEventsChangeEventIDType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "link": - *e = PatchV1ChangesEventsChangeEventIDType(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1ChangesEventsChangeEventIDType: %v", v) - } -} - -type PatchV1ChangesEventsChangeEventIDAttachments struct { - Type PatchV1ChangesEventsChangeEventIDType `json:"type"` -} - -func (o *PatchV1ChangesEventsChangeEventIDAttachments) GetType() PatchV1ChangesEventsChangeEventIDType { - if o == nil { - return PatchV1ChangesEventsChangeEventIDType("") - } - return o.Type -} - -// PatchV1ChangesEventsChangeEventID - Update a change event -type PatchV1ChangesEventsChangeEventID struct { - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - StartsAt *time.Time `json:"starts_at,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` - // An array of environment IDs (setting this will overwrite the current environments) - Environments []string `json:"environments,omitempty"` - // An array of service IDs (setting this will overwrite the current services) - Services []string `json:"services,omitempty"` - // JSON objects representing attachments, see attachments documentation for the schema - Attachments []PatchV1ChangesEventsChangeEventIDAttachments `json:"attachments,omitempty"` -} - -func (p PatchV1ChangesEventsChangeEventID) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PatchV1ChangesEventsChangeEventID) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PatchV1ChangesEventsChangeEventID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PatchV1ChangesEventsChangeEventID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1ChangesEventsChangeEventID) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PatchV1ChangesEventsChangeEventID) GetStartsAt() *time.Time { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *PatchV1ChangesEventsChangeEventID) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *PatchV1ChangesEventsChangeEventID) GetEnvironments() []string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *PatchV1ChangesEventsChangeEventID) GetServices() []string { - if o == nil { - return nil - } - return o.Services -} - -func (o *PatchV1ChangesEventsChangeEventID) GetAttachments() []PatchV1ChangesEventsChangeEventIDAttachments { - if o == nil { - return nil - } - return o.Attachments -} diff --git a/internal/sdk/models/shared/patchv1checklisttemplatesid.go b/internal/sdk/models/shared/patchv1checklisttemplatesid.go deleted file mode 100644 index d39731a..0000000 --- a/internal/sdk/models/shared/patchv1checklisttemplatesid.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PatchV1ChecklistTemplatesIDChecks struct { - // Specify the check ID when updating an already existing check - ID *string `json:"id,omitempty"` - // The description of the check - Description *string `json:"description,omitempty"` - // The name of the check - Name string `json:"name"` -} - -func (o *PatchV1ChecklistTemplatesIDChecks) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PatchV1ChecklistTemplatesIDChecks) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1ChecklistTemplatesIDChecks) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -type PatchV1ChecklistTemplatesIDConnectedServices struct { - ID string `json:"id"` - // Set to `true` to remove checklist from service - Remove *bool `json:"remove,omitempty"` -} - -func (o *PatchV1ChecklistTemplatesIDConnectedServices) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1ChecklistTemplatesIDConnectedServices) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -// PatchV1ChecklistTemplatesID - Update a checklist templates attributes -type PatchV1ChecklistTemplatesID struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - // An array of checks for the checklist template - Checks []PatchV1ChecklistTemplatesIDChecks `json:"checks,omitempty"` - // The ID of the Team that owns the checklist template - TeamID *string `json:"team_id,omitempty"` - // Array of service IDs to attach checklist template to - ConnectedServices []PatchV1ChecklistTemplatesIDConnectedServices `json:"connected_services,omitempty"` - // If set to true, any services tagged on the checklist that are not included in the given array will be removed. Set this to true if you want to do a replacement operation for the services - RemoveRemainingConnectedServices *bool `json:"remove_remaining_connected_services,omitempty"` -} - -func (o *PatchV1ChecklistTemplatesID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1ChecklistTemplatesID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1ChecklistTemplatesID) GetChecks() []PatchV1ChecklistTemplatesIDChecks { - if o == nil { - return nil - } - return o.Checks -} - -func (o *PatchV1ChecklistTemplatesID) GetTeamID() *string { - if o == nil { - return nil - } - return o.TeamID -} - -func (o *PatchV1ChecklistTemplatesID) GetConnectedServices() []PatchV1ChecklistTemplatesIDConnectedServices { - if o == nil { - return nil - } - return o.ConnectedServices -} - -func (o *PatchV1ChecklistTemplatesID) GetRemoveRemainingConnectedServices() *bool { - if o == nil { - return nil - } - return o.RemoveRemainingConnectedServices -} diff --git a/internal/sdk/models/shared/patchv1conversationsconversationidcommentscommentid.go b/internal/sdk/models/shared/patchv1conversationsconversationidcommentscommentid.go deleted file mode 100644 index 0cb567c..0000000 --- a/internal/sdk/models/shared/patchv1conversationsconversationidcommentscommentid.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1ConversationsConversationIDCommentsCommentID - ALPHA - Update a comment's attributes -type PatchV1ConversationsConversationIDCommentsCommentID struct { - // Text body of comment - Body *string `json:"body,omitempty"` -} - -func (o *PatchV1ConversationsConversationIDCommentsCommentID) GetBody() *string { - if o == nil { - return nil - } - return o.Body -} diff --git a/internal/sdk/models/shared/patchv1customfieldsdefinitionsfieldid.go b/internal/sdk/models/shared/patchv1customfieldsdefinitionsfieldid.go deleted file mode 100644 index 9fe26da..0000000 --- a/internal/sdk/models/shared/patchv1customfieldsdefinitionsfieldid.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1CustomFieldsDefinitionsFieldID - Update a single custom field definition -type PatchV1CustomFieldsDefinitionsFieldID struct { - Description *string `json:"description,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - PermissibleValues []string `json:"permissible_values,omitempty"` - Required *bool `json:"required,omitempty"` - // An optional milestone ID to specify when the field should become required, if `required` is set to `true`. If not provided, required fields are always required. - RequiredAtMilestoneID *string `json:"required_at_milestone_id,omitempty"` -} - -func (o *PatchV1CustomFieldsDefinitionsFieldID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1CustomFieldsDefinitionsFieldID) GetDisplayName() *string { - if o == nil { - return nil - } - return o.DisplayName -} - -func (o *PatchV1CustomFieldsDefinitionsFieldID) GetPermissibleValues() []string { - if o == nil { - return nil - } - return o.PermissibleValues -} - -func (o *PatchV1CustomFieldsDefinitionsFieldID) GetRequired() *bool { - if o == nil { - return nil - } - return o.Required -} - -func (o *PatchV1CustomFieldsDefinitionsFieldID) GetRequiredAtMilestoneID() *string { - if o == nil { - return nil - } - return o.RequiredAtMilestoneID -} diff --git a/internal/sdk/models/shared/patchv1environmentsenvironmentid.go b/internal/sdk/models/shared/patchv1environmentsenvironmentid.go deleted file mode 100644 index 6d6dca6..0000000 --- a/internal/sdk/models/shared/patchv1environmentsenvironmentid.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1EnvironmentsEnvironmentID - Update a environments attributes -type PatchV1EnvironmentsEnvironmentID struct { - Name string `json:"name"` - Description *string `json:"description,omitempty"` -} - -func (o *PatchV1EnvironmentsEnvironmentID) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PatchV1EnvironmentsEnvironmentID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} diff --git a/internal/sdk/models/shared/patchv1functionalitiesfunctionalityid.go b/internal/sdk/models/shared/patchv1functionalitiesfunctionalityid.go deleted file mode 100644 index c166105..0000000 --- a/internal/sdk/models/shared/patchv1functionalitiesfunctionalityid.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" -) - -type PatchV1FunctionalitiesFunctionalityIDServices struct { - // ID of a service - ID string `json:"id"` - // Set to true if you want to remove the given service from the functionality - Remove *bool `json:"remove,omitempty"` -} - -func (o *PatchV1FunctionalitiesFunctionalityIDServices) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1FunctionalitiesFunctionalityIDServices) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -type PatchV1FunctionalitiesFunctionalityIDLinks struct { - // URL - HrefURL string `json:"href_url"` - // Short name used to display and identify this link - Name string `json:"name"` - // An optional URL to an icon representing this link - IconURL *string `json:"icon_url,omitempty"` - // If you are trying to remove a link, set this to 'true' - Remove *bool `json:"remove,omitempty"` - // If updating an existing link, specify it's id. - ID *string `json:"id,omitempty"` -} - -func (o *PatchV1FunctionalitiesFunctionalityIDLinks) GetHrefURL() string { - if o == nil { - return "" - } - return o.HrefURL -} - -func (o *PatchV1FunctionalitiesFunctionalityIDLinks) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PatchV1FunctionalitiesFunctionalityIDLinks) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -func (o *PatchV1FunctionalitiesFunctionalityIDLinks) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -func (o *PatchV1FunctionalitiesFunctionalityIDLinks) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -// PatchV1FunctionalitiesFunctionalityIDOwner - An object representing a Team that owns the functionality -type PatchV1FunctionalitiesFunctionalityIDOwner struct { - ID string `json:"id"` -} - -func (o *PatchV1FunctionalitiesFunctionalityIDOwner) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type PatchV1FunctionalitiesFunctionalityIDTeams struct { - ID string `json:"id"` - // If you are trying to remove a team from a functionality, set this to 'true' - Remove *bool `json:"remove,omitempty"` -} - -func (o *PatchV1FunctionalitiesFunctionalityIDTeams) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1FunctionalitiesFunctionalityIDTeams) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -type PatchV1FunctionalitiesFunctionalityIDExternalResources struct { - RemoteID string `json:"remote_id"` - // The integration slug for the external resource. Can be one of: github, opsgenie, pager_duty, statuspage, victorops. Not required if the resource has already been imported. - ConnectionType *string `json:"connection_type,omitempty"` - // If you are trying to remove an external resource from a service, set this to 'true'. - Remove *bool `json:"remove,omitempty"` -} - -func (o *PatchV1FunctionalitiesFunctionalityIDExternalResources) GetRemoteID() string { - if o == nil { - return "" - } - return o.RemoteID -} - -func (o *PatchV1FunctionalitiesFunctionalityIDExternalResources) GetConnectionType() *string { - if o == nil { - return nil - } - return o.ConnectionType -} - -func (o *PatchV1FunctionalitiesFunctionalityIDExternalResources) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -// PatchV1FunctionalitiesFunctionalityID - Update a functionalities attributes -type PatchV1FunctionalitiesFunctionalityID struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Services []PatchV1FunctionalitiesFunctionalityIDServices `json:"services,omitempty"` - // An array of links to associate with this functionality. This will remove all links not present in the patch. Only acts if 'links' key is included in the payload. - Links []PatchV1FunctionalitiesFunctionalityIDLinks `json:"links,omitempty"` - // An object representing a Team that owns the functionality - Owner *PatchV1FunctionalitiesFunctionalityIDOwner `json:"owner,omitempty"` - // If you are trying to remove a team as an owner from a functionality, set this to 'true' - RemoveOwner *bool `json:"remove_owner,omitempty"` - // An array of teams to attach to this functionality. - Teams []PatchV1FunctionalitiesFunctionalityIDTeams `json:"teams,omitempty"` - // If set to true, any teams tagged on the service that are not included in the given array will be removed. Set this to true if you want to do a replacement operation for the teams - RemoveRemainingTeams *bool `json:"remove_remaining_teams,omitempty"` - // An array of external resources to attach to this service. - ExternalResources []PatchV1FunctionalitiesFunctionalityIDExternalResources `json:"external_resources,omitempty"` - // If set to true, any external_resources tagged on the service that are not included in the given array will be removed. Set this to true if you want to do a replacement operation for the external_resources - RemoveRemainingExternalResources *bool `json:"remove_remaining_external_resources,omitempty"` - // A hash of label keys and values - Labels map[string]string `json:"labels,omitempty"` - AlertOnAdd *bool `json:"alert_on_add,omitempty"` - AutoAddRespondingTeam *bool `json:"auto_add_responding_team,omitempty"` - // Set this to true if you want to remove all of the services that are not included in the services array from the functionality - RemoveRemainingServices *bool `default:"false" json:"remove_remaining_services"` -} - -func (p PatchV1FunctionalitiesFunctionalityID) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PatchV1FunctionalitiesFunctionalityID) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetServices() []PatchV1FunctionalitiesFunctionalityIDServices { - if o == nil { - return nil - } - return o.Services -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetLinks() []PatchV1FunctionalitiesFunctionalityIDLinks { - if o == nil { - return nil - } - return o.Links -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetOwner() *PatchV1FunctionalitiesFunctionalityIDOwner { - if o == nil { - return nil - } - return o.Owner -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetRemoveOwner() *bool { - if o == nil { - return nil - } - return o.RemoveOwner -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetTeams() []PatchV1FunctionalitiesFunctionalityIDTeams { - if o == nil { - return nil - } - return o.Teams -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetRemoveRemainingTeams() *bool { - if o == nil { - return nil - } - return o.RemoveRemainingTeams -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetExternalResources() []PatchV1FunctionalitiesFunctionalityIDExternalResources { - if o == nil { - return nil - } - return o.ExternalResources -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetRemoveRemainingExternalResources() *bool { - if o == nil { - return nil - } - return o.RemoveRemainingExternalResources -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetAlertOnAdd() *bool { - if o == nil { - return nil - } - return o.AlertOnAdd -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetAutoAddRespondingTeam() *bool { - if o == nil { - return nil - } - return o.AutoAddRespondingTeam -} - -func (o *PatchV1FunctionalitiesFunctionalityID) GetRemoveRemainingServices() *bool { - if o == nil { - return nil - } - return o.RemoveRemainingServices -} diff --git a/internal/sdk/models/shared/patchv1incidentrolesincidentroleid.go b/internal/sdk/models/shared/patchv1incidentrolesincidentroleid.go deleted file mode 100644 index 940f146..0000000 --- a/internal/sdk/models/shared/patchv1incidentrolesincidentroleid.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1IncidentRolesIncidentRoleID - Update a single incident role from its ID -type PatchV1IncidentRolesIncidentRoleID struct { - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` -} - -func (o *PatchV1IncidentRolesIncidentRoleID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1IncidentRolesIncidentRoleID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PatchV1IncidentRolesIncidentRoleID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} diff --git a/internal/sdk/models/shared/patchv1incidentsincidentid.go b/internal/sdk/models/shared/patchv1incidentsincidentid.go deleted file mode 100644 index 22f9267..0000000 --- a/internal/sdk/models/shared/patchv1incidentsincidentid.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1IncidentsIncidentID - Updates an incident with provided parameters -type PatchV1IncidentsIncidentID struct { - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - CustomerImpactSummary *string `json:"customer_impact_summary,omitempty"` - Description *string `json:"description,omitempty"` - // Key:value pairs to track custom data for the incident - Labels map[string]string `json:"labels,omitempty"` - Priority *string `json:"priority,omitempty"` - Severity *string `json:"severity,omitempty"` - SeverityConditionID *string `json:"severity_condition_id,omitempty"` - SeverityImpactID *string `json:"severity_impact_id,omitempty"` - // List of tags for the incident - TagList []string `json:"tag_list,omitempty"` -} - -func (o *PatchV1IncidentsIncidentID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1IncidentsIncidentID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PatchV1IncidentsIncidentID) GetCustomerImpactSummary() *string { - if o == nil { - return nil - } - return o.CustomerImpactSummary -} - -func (o *PatchV1IncidentsIncidentID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1IncidentsIncidentID) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PatchV1IncidentsIncidentID) GetPriority() *string { - if o == nil { - return nil - } - return o.Priority -} - -func (o *PatchV1IncidentsIncidentID) GetSeverity() *string { - if o == nil { - return nil - } - return o.Severity -} - -func (o *PatchV1IncidentsIncidentID) GetSeverityConditionID() *string { - if o == nil { - return nil - } - return o.SeverityConditionID -} - -func (o *PatchV1IncidentsIncidentID) GetSeverityImpactID() *string { - if o == nil { - return nil - } - return o.SeverityImpactID -} - -func (o *PatchV1IncidentsIncidentID) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} diff --git a/internal/sdk/models/shared/patchv1incidentsincidentidalertsincidentalertidprimary.go b/internal/sdk/models/shared/patchv1incidentsincidentidalertsincidentalertidprimary.go deleted file mode 100644 index 51c6428..0000000 --- a/internal/sdk/models/shared/patchv1incidentsincidentidalertsincidentalertidprimary.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary - Setting an alert as primary will overwrite milestone times in the FireHydrant incident with times included in the primary alert. Services attached to the primary alert will also be automatically added to the incident. -type PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary struct { - Primary bool `json:"primary"` -} - -func (o *PatchV1IncidentsIncidentIDAlertsIncidentAlertIDPrimary) GetPrimary() bool { - if o == nil { - return false - } - return o.Primary -} diff --git a/internal/sdk/models/shared/patchv1incidentsincidentideventseventidvotes.go b/internal/sdk/models/shared/patchv1incidentsincidentideventseventidvotes.go deleted file mode 100644 index 42b881c..0000000 --- a/internal/sdk/models/shared/patchv1incidentsincidentideventseventidvotes.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// Direction - The direction you would like to vote, or if you dig it -type Direction string - -const ( - DirectionUp Direction = "up" - DirectionDown Direction = "down" - DirectionDig Direction = "dig" -) - -func (e Direction) ToPointer() *Direction { - return &e -} -func (e *Direction) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "up": - fallthrough - case "down": - fallthrough - case "dig": - *e = Direction(v) - return nil - default: - return fmt.Errorf("invalid value for Direction: %v", v) - } -} - -// PatchV1IncidentsIncidentIDEventsEventIDVotes - Allows for upvoting or downvoting an event -type PatchV1IncidentsIncidentIDEventsEventIDVotes struct { - // The direction you would like to vote, or if you dig it - Direction Direction `json:"direction"` -} - -func (o *PatchV1IncidentsIncidentIDEventsEventIDVotes) GetDirection() Direction { - if o == nil { - return Direction("") - } - return o.Direction -} diff --git a/internal/sdk/models/shared/patchv1incidentsincidentidgenericchatmessagesmessageid.go b/internal/sdk/models/shared/patchv1incidentsincidentidgenericchatmessagesmessageid.go deleted file mode 100644 index 68c365a..0000000 --- a/internal/sdk/models/shared/patchv1incidentsincidentidgenericchatmessagesmessageid.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1IncidentsIncidentIDGenericChatMessagesMessageID - Update an existing generic chat message on an incident. -type PatchV1IncidentsIncidentIDGenericChatMessagesMessageID struct { - Body string `json:"body"` -} - -func (o *PatchV1IncidentsIncidentIDGenericChatMessagesMessageID) GetBody() string { - if o == nil { - return "" - } - return o.Body -} diff --git a/internal/sdk/models/shared/patchv1incidentsincidentidimpact.go b/internal/sdk/models/shared/patchv1incidentsincidentidimpact.go deleted file mode 100644 index edbf3dc..0000000 --- a/internal/sdk/models/shared/patchv1incidentsincidentidimpact.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type Impact struct { - ID string `json:"id"` - ConditionID string `json:"condition_id"` -} - -func (o *Impact) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *Impact) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -type StatusPages struct { - ID string `json:"id"` - IntegrationSlug string `json:"integration_slug"` -} - -func (o *StatusPages) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *StatusPages) GetIntegrationSlug() string { - if o == nil { - return "" - } - return o.IntegrationSlug -} - -// PatchV1IncidentsIncidentIDImpact - Allows updating an incident's impacted infrastructure, with the option to -// move the incident into a different milestone and provide a note to update -// the incident timeline and any attached status pages. If this method is -// requested with the PUT verb, impacts will be completely replaced with the -// information in the request body, even if not provided (effectively clearing -// all impacts). If this method is requested with the PATCH verb, the provided -// impacts will be added or updated, but no impacts will be removed. -type PatchV1IncidentsIncidentIDImpact struct { - Note *string `json:"note,omitempty"` - Milestone *string `json:"milestone,omitempty"` - Impact []Impact `json:"impact,omitempty"` - StatusPages []StatusPages `json:"status_pages,omitempty"` -} - -func (o *PatchV1IncidentsIncidentIDImpact) GetNote() *string { - if o == nil { - return nil - } - return o.Note -} - -func (o *PatchV1IncidentsIncidentIDImpact) GetMilestone() *string { - if o == nil { - return nil - } - return o.Milestone -} - -func (o *PatchV1IncidentsIncidentIDImpact) GetImpact() []Impact { - if o == nil { - return nil - } - return o.Impact -} - -func (o *PatchV1IncidentsIncidentIDImpact) GetStatusPages() []StatusPages { - if o == nil { - return nil - } - return o.StatusPages -} diff --git a/internal/sdk/models/shared/patchv1incidentsincidentidnotesnoteid.go b/internal/sdk/models/shared/patchv1incidentsincidentidnotesnoteid.go deleted file mode 100644 index ac55b5b..0000000 --- a/internal/sdk/models/shared/patchv1incidentsincidentidnotesnoteid.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1IncidentsIncidentIDNotesNoteID - Updates the body of a note -type PatchV1IncidentsIncidentIDNotesNoteID struct { - Body string `json:"body"` -} - -func (o *PatchV1IncidentsIncidentIDNotesNoteID) GetBody() string { - if o == nil { - return "" - } - return o.Body -} diff --git a/internal/sdk/models/shared/patchv1incidentsincidentidrelatedchangeeventsrelatedchangeeventid.go b/internal/sdk/models/shared/patchv1incidentsincidentidrelatedchangeeventsrelatedchangeeventid.go deleted file mode 100644 index dd3b403..0000000 --- a/internal/sdk/models/shared/patchv1incidentsincidentidrelatedchangeeventsrelatedchangeeventid.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType string - -const ( - PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDTypeCaused PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType = "caused" - PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDTypeFixed PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType = "fixed" - PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDTypeSuspect PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType = "suspect" - PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDTypeDismissed PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType = "dismissed" -) - -func (e PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType) ToPointer() *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType { - return &e -} -func (e *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "caused": - fallthrough - case "fixed": - fallthrough - case "suspect": - fallthrough - case "dismissed": - *e = PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType: %v", v) - } -} - -// PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID - Update a change attached to an incident -type PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID struct { - Type *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType `json:"type,omitempty"` - // A short description about why this change event is related - Why *string `json:"why,omitempty"` -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID) GetType() *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventIDType { - if o == nil { - return nil - } - return o.Type -} - -func (o *PatchV1IncidentsIncidentIDRelatedChangeEventsRelatedChangeEventID) GetWhy() *string { - if o == nil { - return nil - } - return o.Why -} diff --git a/internal/sdk/models/shared/patchv1incidentsincidentidtaskstaskid.go b/internal/sdk/models/shared/patchv1incidentsincidentidtaskstaskid.go deleted file mode 100644 index 04e072a..0000000 --- a/internal/sdk/models/shared/patchv1incidentsincidentidtaskstaskid.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1IncidentsIncidentIDTasksTaskID - Update a task's attributes -type PatchV1IncidentsIncidentIDTasksTaskID struct { - // The title of the task. - Title *string `json:"title,omitempty"` - // A description of what the task is for. - Description *string `json:"description,omitempty"` - // The state of the task. One of: open, in_progress, cancelled, done - State *string `json:"state,omitempty"` - // The ID of the user assigned to the task. - AssigneeID *string `json:"assignee_id,omitempty"` - // The due date of the task. Relative values are supported such as '5m' - DueAt *string `json:"due_at,omitempty"` -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskID) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskID) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskID) GetAssigneeID() *string { - if o == nil { - return nil - } - return o.AssigneeID -} - -func (o *PatchV1IncidentsIncidentIDTasksTaskID) GetDueAt() *string { - if o == nil { - return nil - } - return o.DueAt -} diff --git a/internal/sdk/models/shared/patchv1incidenttypesid.go b/internal/sdk/models/shared/patchv1incidenttypesid.go deleted file mode 100644 index 4cc0304..0000000 --- a/internal/sdk/models/shared/patchv1incidenttypesid.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PatchV1IncidentTypesIDImpacts struct { - // The id of impact - ID string `json:"id"` - // The id of the condition - ConditionID string `json:"condition_id"` -} - -func (o *PatchV1IncidentTypesIDImpacts) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1IncidentTypesIDImpacts) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -type PatchV1IncidentTypesIDTemplate struct { - Description *string `json:"description,omitempty"` - CustomerImpactSummary *string `json:"customer_impact_summary,omitempty"` - // A labels hash of keys and values - Labels map[string]string `json:"labels,omitempty"` - Severity *string `json:"severity,omitempty"` - Priority *string `json:"priority,omitempty"` - // List of tags for the incident - TagList []string `json:"tag_list,omitempty"` - // List of ids of Runbooks to attach to incidents created from this type - RunbookIds []string `json:"runbook_ids,omitempty"` - PrivateIncident *bool `json:"private_incident,omitempty"` - // List of ids of teams to be assigned to incidents - TeamIds []string `json:"team_ids,omitempty"` - // An array of impact/condition combinations - Impacts []PatchV1IncidentTypesIDImpacts `json:"impacts,omitempty"` -} - -func (o *PatchV1IncidentTypesIDTemplate) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1IncidentTypesIDTemplate) GetCustomerImpactSummary() *string { - if o == nil { - return nil - } - return o.CustomerImpactSummary -} - -func (o *PatchV1IncidentTypesIDTemplate) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PatchV1IncidentTypesIDTemplate) GetSeverity() *string { - if o == nil { - return nil - } - return o.Severity -} - -func (o *PatchV1IncidentTypesIDTemplate) GetPriority() *string { - if o == nil { - return nil - } - return o.Priority -} - -func (o *PatchV1IncidentTypesIDTemplate) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} - -func (o *PatchV1IncidentTypesIDTemplate) GetRunbookIds() []string { - if o == nil { - return nil - } - return o.RunbookIds -} - -func (o *PatchV1IncidentTypesIDTemplate) GetPrivateIncident() *bool { - if o == nil { - return nil - } - return o.PrivateIncident -} - -func (o *PatchV1IncidentTypesIDTemplate) GetTeamIds() []string { - if o == nil { - return nil - } - return o.TeamIds -} - -func (o *PatchV1IncidentTypesIDTemplate) GetImpacts() []PatchV1IncidentTypesIDImpacts { - if o == nil { - return nil - } - return o.Impacts -} - -// PatchV1IncidentTypesID - Update a single incident type from its ID -type PatchV1IncidentTypesID struct { - Name string `json:"name"` - Template PatchV1IncidentTypesIDTemplate `json:"template"` -} - -func (o *PatchV1IncidentTypesID) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PatchV1IncidentTypesID) GetTemplate() PatchV1IncidentTypesIDTemplate { - if o == nil { - return PatchV1IncidentTypesIDTemplate{} - } - return o.Template -} diff --git a/internal/sdk/models/shared/patchv1integrationsawscloudtrailbatchesid.go b/internal/sdk/models/shared/patchv1integrationsawscloudtrailbatchesid.go deleted file mode 100644 index 969266d..0000000 --- a/internal/sdk/models/shared/patchv1integrationsawscloudtrailbatchesid.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// PatchV1IntegrationsAwsCloudtrailBatchesID - Update a CloudTrail batch with new information. -type PatchV1IntegrationsAwsCloudtrailBatchesID struct { - EventsCreated *int `json:"events_created,omitempty"` - Status *string `json:"status,omitempty"` - Error *string `json:"error,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` -} - -func (p PatchV1IntegrationsAwsCloudtrailBatchesID) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PatchV1IntegrationsAwsCloudtrailBatchesID) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesID) GetEventsCreated() *int { - if o == nil { - return nil - } - return o.EventsCreated -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesID) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesID) GetError() *string { - if o == nil { - return nil - } - return o.Error -} - -func (o *PatchV1IntegrationsAwsCloudtrailBatchesID) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} diff --git a/internal/sdk/models/shared/patchv1integrationsawsconnectionsid.go b/internal/sdk/models/shared/patchv1integrationsawsconnectionsid.go deleted file mode 100644 index 9f03874..0000000 --- a/internal/sdk/models/shared/patchv1integrationsawsconnectionsid.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1IntegrationsAwsConnectionsID - Update the AWS connection with the provided data. -type PatchV1IntegrationsAwsConnectionsID struct { - AwsAccountID *string `json:"aws_account_id,omitempty"` - TargetArn *string `json:"target_arn,omitempty"` - ConnectionStatus *string `json:"connection_status,omitempty"` -} - -func (o *PatchV1IntegrationsAwsConnectionsID) GetAwsAccountID() *string { - if o == nil { - return nil - } - return o.AwsAccountID -} - -func (o *PatchV1IntegrationsAwsConnectionsID) GetTargetArn() *string { - if o == nil { - return nil - } - return o.TargetArn -} - -func (o *PatchV1IntegrationsAwsConnectionsID) GetConnectionStatus() *string { - if o == nil { - return nil - } - return o.ConnectionStatus -} diff --git a/internal/sdk/models/shared/patchv1integrationsstatuspageconnectionsconnectionid.go b/internal/sdk/models/shared/patchv1integrationsstatuspageconnectionsconnectionid.go deleted file mode 100644 index f2c63ee..0000000 --- a/internal/sdk/models/shared/patchv1integrationsstatuspageconnectionsconnectionid.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type Severities struct { - // FireHydrant severity slug - SeveritySlug string `json:"severity_slug"` - // Statuspage.io severity name - RemoteStatus string `json:"remote_status"` -} - -func (o *Severities) GetSeveritySlug() string { - if o == nil { - return "" - } - return o.SeveritySlug -} - -func (o *Severities) GetRemoteStatus() string { - if o == nil { - return "" - } - return o.RemoteStatus -} - -type Conditions struct { - // FireHydrant condition id - ConditionID string `json:"condition_id"` - // Statuspage.io condition name - StatuspageioCondition string `json:"statuspageio_condition"` -} - -func (o *Conditions) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -func (o *Conditions) GetStatuspageioCondition() string { - if o == nil { - return "" - } - return o.StatuspageioCondition -} - -// PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus - Statuspage.io status -type PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus string - -const ( - PatchV1IntegrationsStatuspageConnectionsConnectionIDStatusInvestigating PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus = "investigating" - PatchV1IntegrationsStatuspageConnectionsConnectionIDStatusIdentified PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus = "identified" - PatchV1IntegrationsStatuspageConnectionsConnectionIDStatusMonitoring PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus = "monitoring" - PatchV1IntegrationsStatuspageConnectionsConnectionIDStatusResolved PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus = "resolved" -) - -func (e PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus) ToPointer() *PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus { - return &e -} -func (e *PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "investigating": - fallthrough - case "identified": - fallthrough - case "monitoring": - fallthrough - case "resolved": - *e = PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus: %v", v) - } -} - -type MilestoneMappings struct { - // FireHydrant milestone id - MilestoneID string `json:"milestone_id"` - // Statuspage.io status - Status PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus `json:"status"` -} - -func (o *MilestoneMappings) GetMilestoneID() string { - if o == nil { - return "" - } - return o.MilestoneID -} - -func (o *MilestoneMappings) GetStatus() PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus { - if o == nil { - return PatchV1IntegrationsStatuspageConnectionsConnectionIDStatus("") - } - return o.Status -} - -// PatchV1IntegrationsStatuspageConnectionsConnectionID - Update the given Statuspage integration connection. -type PatchV1IntegrationsStatuspageConnectionsConnectionID struct { - PageID *string `json:"page_id,omitempty"` - Severities []Severities `json:"severities,omitempty"` - Conditions []Conditions `json:"conditions,omitempty"` - MilestoneMappings []MilestoneMappings `json:"milestone_mappings,omitempty"` -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionID) GetPageID() *string { - if o == nil { - return nil - } - return o.PageID -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionID) GetSeverities() []Severities { - if o == nil { - return nil - } - return o.Severities -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionID) GetConditions() []Conditions { - if o == nil { - return nil - } - return o.Conditions -} - -func (o *PatchV1IntegrationsStatuspageConnectionsConnectionID) GetMilestoneMappings() []MilestoneMappings { - if o == nil { - return nil - } - return o.MilestoneMappings -} diff --git a/internal/sdk/models/shared/patchv1nuncconnectionsnuncconnectionidlinkslinkid.go b/internal/sdk/models/shared/patchv1nuncconnectionsnuncconnectionidlinkslinkid.go deleted file mode 100644 index 1cd50b0..0000000 --- a/internal/sdk/models/shared/patchv1nuncconnectionsnuncconnectionidlinkslinkid.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1NuncConnectionsNuncConnectionIDLinksLinkID - Update a link to be displayed on a FireHydrant status page -type PatchV1NuncConnectionsNuncConnectionIDLinksLinkID struct { - DisplayText *string `json:"display_text,omitempty"` - IconURL *string `json:"icon_url,omitempty"` - HrefURL *string `json:"href_url,omitempty"` -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkID) GetDisplayText() *string { - if o == nil { - return nil - } - return o.DisplayText -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkID) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -func (o *PatchV1NuncConnectionsNuncConnectionIDLinksLinkID) GetHrefURL() *string { - if o == nil { - return nil - } - return o.HrefURL -} diff --git a/internal/sdk/models/shared/patchv1postmortemsreportsreportid.go b/internal/sdk/models/shared/patchv1postmortemsreportsreportid.go deleted file mode 100644 index 0dd69b0..0000000 --- a/internal/sdk/models/shared/patchv1postmortemsreportsreportid.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type Questions struct { - // ID of a question - ID *string `json:"id,omitempty"` - // Answer to question - Body *string `json:"body,omitempty"` -} - -func (o *Questions) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *Questions) GetBody() *string { - if o == nil { - return nil - } - return o.Body -} - -// PatchV1PostMortemsReportsReportID - Update a report -type PatchV1PostMortemsReportsReportID struct { - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - AdditionalDetails *string `json:"additional_details,omitempty"` - Questions []Questions `json:"questions,omitempty"` -} - -func (o *PatchV1PostMortemsReportsReportID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1PostMortemsReportsReportID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PatchV1PostMortemsReportsReportID) GetAdditionalDetails() *string { - if o == nil { - return nil - } - return o.AdditionalDetails -} - -func (o *PatchV1PostMortemsReportsReportID) GetQuestions() []Questions { - if o == nil { - return nil - } - return o.Questions -} diff --git a/internal/sdk/models/shared/patchv1postmortemsreportsreportidfieldsfieldid.go b/internal/sdk/models/shared/patchv1postmortemsreportsreportidfieldsfieldid.go deleted file mode 100644 index b47debe..0000000 --- a/internal/sdk/models/shared/patchv1postmortemsreportsreportidfieldsfieldid.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1PostMortemsReportsReportIDFieldsFieldID - Update a field value on a post mortem report -type PatchV1PostMortemsReportsReportIDFieldsFieldID struct { - Value string `json:"value"` -} - -func (o *PatchV1PostMortemsReportsReportIDFieldsFieldID) GetValue() string { - if o == nil { - return "" - } - return o.Value -} diff --git a/internal/sdk/models/shared/patchv1postmortemsreportsreportidreasonsreasonid.go b/internal/sdk/models/shared/patchv1postmortemsreportsreportidreasonsreasonid.go deleted file mode 100644 index 7d9fe80..0000000 --- a/internal/sdk/models/shared/patchv1postmortemsreportsreportidreasonsreasonid.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1PostMortemsReportsReportIDReasonsReasonID - Update a contributing factor -type PatchV1PostMortemsReportsReportIDReasonsReasonID struct { - Summary *string `json:"summary,omitempty"` -} - -func (o *PatchV1PostMortemsReportsReportIDReasonsReasonID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} diff --git a/internal/sdk/models/shared/patchv1prioritiespriorityslug.go b/internal/sdk/models/shared/patchv1prioritiespriorityslug.go deleted file mode 100644 index 611d639..0000000 --- a/internal/sdk/models/shared/patchv1prioritiespriorityslug.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1PrioritiesPrioritySlug - Update a specific priority -type PatchV1PrioritiesPrioritySlug struct { - Slug *string `json:"slug,omitempty"` - Description *string `json:"description,omitempty"` - Default *bool `json:"default,omitempty"` -} - -func (o *PatchV1PrioritiesPrioritySlug) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PatchV1PrioritiesPrioritySlug) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1PrioritiesPrioritySlug) GetDefault() *bool { - if o == nil { - return nil - } - return o.Default -} diff --git a/internal/sdk/models/shared/patchv1runbooksexecutionsexecutionidstepsstepidvotes.go b/internal/sdk/models/shared/patchv1runbooksexecutionsexecutionidstepsstepidvotes.go deleted file mode 100644 index 6ecc171..0000000 --- a/internal/sdk/models/shared/patchv1runbooksexecutionsexecutionidstepsstepidvotes.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection - The direction you would like to vote, or if you dig it -type PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection string - -const ( - PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirectionUp PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection = "up" - PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirectionDown PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection = "down" - PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirectionDig PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection = "dig" -) - -func (e PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection) ToPointer() *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection { - return &e -} -func (e *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "up": - fallthrough - case "down": - fallthrough - case "dig": - *e = PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection: %v", v) - } -} - -// PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes - Allows for upvoting or downvoting an event -type PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes struct { - // The direction you would like to vote, or if you dig it - Direction PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection `json:"direction"` -} - -func (o *PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes) GetDirection() PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection { - if o == nil { - return PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesDirection("") - } - return o.Direction -} diff --git a/internal/sdk/models/shared/patchv1runbooksexecutionsexecutionidvotes.go b/internal/sdk/models/shared/patchv1runbooksexecutionsexecutionidvotes.go deleted file mode 100644 index 2a2b4ad..0000000 --- a/internal/sdk/models/shared/patchv1runbooksexecutionsexecutionidvotes.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// PatchV1RunbooksExecutionsExecutionIDVotesDirection - The direction you would like to vote, or if you dig it -type PatchV1RunbooksExecutionsExecutionIDVotesDirection string - -const ( - PatchV1RunbooksExecutionsExecutionIDVotesDirectionUp PatchV1RunbooksExecutionsExecutionIDVotesDirection = "up" - PatchV1RunbooksExecutionsExecutionIDVotesDirectionDown PatchV1RunbooksExecutionsExecutionIDVotesDirection = "down" - PatchV1RunbooksExecutionsExecutionIDVotesDirectionDig PatchV1RunbooksExecutionsExecutionIDVotesDirection = "dig" -) - -func (e PatchV1RunbooksExecutionsExecutionIDVotesDirection) ToPointer() *PatchV1RunbooksExecutionsExecutionIDVotesDirection { - return &e -} -func (e *PatchV1RunbooksExecutionsExecutionIDVotesDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "up": - fallthrough - case "down": - fallthrough - case "dig": - *e = PatchV1RunbooksExecutionsExecutionIDVotesDirection(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1RunbooksExecutionsExecutionIDVotesDirection: %v", v) - } -} - -// PatchV1RunbooksExecutionsExecutionIDVotes - Allows for upvoting or downvoting an event -type PatchV1RunbooksExecutionsExecutionIDVotes struct { - // The direction you would like to vote, or if you dig it - Direction PatchV1RunbooksExecutionsExecutionIDVotesDirection `json:"direction"` -} - -func (o *PatchV1RunbooksExecutionsExecutionIDVotes) GetDirection() PatchV1RunbooksExecutionsExecutionIDVotesDirection { - if o == nil { - return PatchV1RunbooksExecutionsExecutionIDVotesDirection("") - } - return o.Direction -} diff --git a/internal/sdk/models/shared/patchv1savedsearchesresourcetypesavedsearchid.go b/internal/sdk/models/shared/patchv1savedsearchesresourcetypesavedsearchid.go deleted file mode 100644 index 1bb9914..0000000 --- a/internal/sdk/models/shared/patchv1savedsearchesresourcetypesavedsearchid.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1SavedSearchesResourceTypeSavedSearchID - Update a specific saved search -type PatchV1SavedSearchesResourceTypeSavedSearchID struct { - IsPrivate *bool `json:"is_private,omitempty"` - Name *string `json:"name,omitempty"` - FilterValues map[string]any `json:"filter_values,omitempty"` -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchID) GetIsPrivate() *bool { - if o == nil { - return nil - } - return o.IsPrivate -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1SavedSearchesResourceTypeSavedSearchID) GetFilterValues() map[string]any { - if o == nil { - return nil - } - return o.FilterValues -} diff --git a/internal/sdk/models/shared/patchv1scheduledmaintenancesscheduledmaintenanceid.go b/internal/sdk/models/shared/patchv1scheduledmaintenancesscheduledmaintenanceid.go deleted file mode 100644 index b66080e..0000000 --- a/internal/sdk/models/shared/patchv1scheduledmaintenancesscheduledmaintenanceid.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type PatchV1ScheduledMaintenancesScheduledMaintenanceIDStatusPages struct { - // The slug identifying the type of status page - IntegrationSlug *string `json:"integration_slug,omitempty"` - // The UUID of the status page to display this maintenance on - ConnectionID string `json:"connection_id"` -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDStatusPages) GetIntegrationSlug() *string { - if o == nil { - return nil - } - return o.IntegrationSlug -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDStatusPages) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -type PatchV1ScheduledMaintenancesScheduledMaintenanceIDImpacts struct { - // The type of impact - Type string `json:"type"` - // The id of impact - ID string `json:"id"` - // The id of the condition - ConditionID string `json:"condition_id"` -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDImpacts) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDImpacts) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDImpacts) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -// PatchV1ScheduledMaintenancesScheduledMaintenanceID - Change the conditions of a scheduled maintenance event, including updating any status page announcements of changes. -type PatchV1ScheduledMaintenancesScheduledMaintenanceID struct { - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - // ISO8601 timestamp for the start time of the scheduled maintenance - StartsAt *time.Time `json:"starts_at,omitempty"` - // ISO8601 timestamp for the end time of the scheduled maintenance - EndsAt *time.Time `json:"ends_at,omitempty"` - Description *string `json:"description,omitempty"` - // A json object of label keys and values - Labels map[string]string `json:"labels,omitempty"` - // An array of status pages to display this maintenance on - StatusPages []PatchV1ScheduledMaintenancesScheduledMaintenanceIDStatusPages `json:"status_pages,omitempty"` - // An array of impact/condition combinations - Impacts []PatchV1ScheduledMaintenancesScheduledMaintenanceIDImpacts `json:"impacts,omitempty"` -} - -func (p PatchV1ScheduledMaintenancesScheduledMaintenanceID) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PatchV1ScheduledMaintenancesScheduledMaintenanceID) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceID) GetStartsAt() *time.Time { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceID) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceID) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceID) GetStatusPages() []PatchV1ScheduledMaintenancesScheduledMaintenanceIDStatusPages { - if o == nil { - return nil - } - return o.StatusPages -} - -func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceID) GetImpacts() []PatchV1ScheduledMaintenancesScheduledMaintenanceIDImpacts { - if o == nil { - return nil - } - return o.Impacts -} diff --git a/internal/sdk/models/shared/patchv1servicedependenciesservicedependencyid.go b/internal/sdk/models/shared/patchv1servicedependenciesservicedependencyid.go deleted file mode 100644 index a6890f6..0000000 --- a/internal/sdk/models/shared/patchv1servicedependenciesservicedependencyid.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1ServiceDependenciesServiceDependencyID - Update the notes of the service dependency -type PatchV1ServiceDependenciesServiceDependencyID struct { - // A note to describe the service dependency relationship - Notes *string `json:"notes,omitempty"` -} - -func (o *PatchV1ServiceDependenciesServiceDependencyID) GetNotes() *string { - if o == nil { - return nil - } - return o.Notes -} diff --git a/internal/sdk/models/shared/patchv1servicesserviceid.go b/internal/sdk/models/shared/patchv1servicesserviceid.go deleted file mode 100644 index 465227c..0000000 --- a/internal/sdk/models/shared/patchv1servicesserviceid.go +++ /dev/null @@ -1,360 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type Checklists struct { - ID string `json:"id"` - // Set to `true` to remove checklist from service - Remove *bool `json:"remove,omitempty"` -} - -func (o *Checklists) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *Checklists) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -type PatchV1ServicesServiceIDExternalResources struct { - RemoteID string `json:"remote_id"` - // The integration slug for the external resource. Can be one of: github, opsgenie, pager_duty, victorops. Not required if the resource has already been imported. - ConnectionType *string `json:"connection_type,omitempty"` - // If you are trying to remove an external resource from a service, set this to 'true'. - Remove *bool `json:"remove,omitempty"` -} - -func (o *PatchV1ServicesServiceIDExternalResources) GetRemoteID() string { - if o == nil { - return "" - } - return o.RemoteID -} - -func (o *PatchV1ServicesServiceIDExternalResources) GetConnectionType() *string { - if o == nil { - return nil - } - return o.ConnectionType -} - -func (o *PatchV1ServicesServiceIDExternalResources) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -type PatchV1ServicesServiceIDFunctionalities struct { - // If you are trying to reuse a functionality, you may set the ID to attach it to the service - ID *string `json:"id,omitempty"` - // If you are trying to remove a functionality from a service, set this to 'true' - Remove *bool `json:"remove,omitempty"` - // If you are trying to create a new functionality and attach it to this service, set the summary key - Summary *string `json:"summary,omitempty"` -} - -func (o *PatchV1ServicesServiceIDFunctionalities) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PatchV1ServicesServiceIDFunctionalities) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -func (o *PatchV1ServicesServiceIDFunctionalities) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -type PatchV1ServicesServiceIDLinks struct { - // URL - HrefURL string `json:"href_url"` - // Short name used to display and identify this link - Name string `json:"name"` - // An optional URL to an icon representing this link - IconURL *string `json:"icon_url,omitempty"` - // If you are trying to remove a link, set this to 'true' - Remove *bool `json:"remove,omitempty"` - // If updating an existing link, specify it's id. - ID *string `json:"id,omitempty"` -} - -func (o *PatchV1ServicesServiceIDLinks) GetHrefURL() string { - if o == nil { - return "" - } - return o.HrefURL -} - -func (o *PatchV1ServicesServiceIDLinks) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PatchV1ServicesServiceIDLinks) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -func (o *PatchV1ServicesServiceIDLinks) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -func (o *PatchV1ServicesServiceIDLinks) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -// PatchV1ServicesServiceIDOwner - An object representing a Team that owns the service -type PatchV1ServicesServiceIDOwner struct { - ID string `json:"id"` -} - -func (o *PatchV1ServicesServiceIDOwner) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -// PatchV1ServicesServiceIDServiceTier - Integer representing service tier -type PatchV1ServicesServiceIDServiceTier int - -const ( - PatchV1ServicesServiceIDServiceTierZero PatchV1ServicesServiceIDServiceTier = 0 - PatchV1ServicesServiceIDServiceTierOne PatchV1ServicesServiceIDServiceTier = 1 - PatchV1ServicesServiceIDServiceTierTwo PatchV1ServicesServiceIDServiceTier = 2 - PatchV1ServicesServiceIDServiceTierThree PatchV1ServicesServiceIDServiceTier = 3 - PatchV1ServicesServiceIDServiceTierFour PatchV1ServicesServiceIDServiceTier = 4 - PatchV1ServicesServiceIDServiceTierFive PatchV1ServicesServiceIDServiceTier = 5 -) - -func (e PatchV1ServicesServiceIDServiceTier) ToPointer() *PatchV1ServicesServiceIDServiceTier { - return &e -} -func (e *PatchV1ServicesServiceIDServiceTier) UnmarshalJSON(data []byte) error { - var v int - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case 0: - fallthrough - case 1: - fallthrough - case 2: - fallthrough - case 3: - fallthrough - case 4: - fallthrough - case 5: - *e = PatchV1ServicesServiceIDServiceTier(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1ServicesServiceIDServiceTier: %v", v) - } -} - -type PatchV1ServicesServiceIDTeams struct { - ID string `json:"id"` - // If you are trying to remove a team from a service, set this to 'true' - Remove *bool `json:"remove,omitempty"` -} - -func (o *PatchV1ServicesServiceIDTeams) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PatchV1ServicesServiceIDTeams) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -// PatchV1ServicesServiceID - Update a services attributes, you may also add or remove functionalities from the service as well. -// Note: You may not remove or add individual label key/value pairs. You must include the entire object to override label values. -type PatchV1ServicesServiceID struct { - AlertOnAdd *bool `json:"alert_on_add,omitempty"` - AutoAddRespondingTeam *bool `json:"auto_add_responding_team,omitempty"` - // Array of checklist IDs to attach to the service - Checklists []Checklists `json:"checklists,omitempty"` - Description *string `json:"description,omitempty"` - // An array of external resources to attach to this service. - ExternalResources []PatchV1ServicesServiceIDExternalResources `json:"external_resources,omitempty"` - // An array of functionalities - Functionalities []PatchV1ServicesServiceIDFunctionalities `json:"functionalities,omitempty"` - // A hash of label keys and values - Labels map[string]string `json:"labels,omitempty"` - // An array of links to associate with this service. This will remove all links not present in the patch. Only acts if 'links' key is included in the payload. - Links []PatchV1ServicesServiceIDLinks `json:"links,omitempty"` - Name *string `json:"name,omitempty"` - // An object representing a Team that owns the service - Owner *PatchV1ServicesServiceIDOwner `json:"owner,omitempty"` - // If you are trying to remove a team as an owner from a service, set this to 'true' - RemoveOwner *bool `json:"remove_owner,omitempty"` - // If set to true, any checklists tagged on the service that are not included in the given array will be removed. Set this to true if you want to do a replacement operation for the checklists - RemoveRemainingChecklists *bool `json:"remove_remaining_checklists,omitempty"` - // If set to true, any external_resources tagged on the service that are not included in the given array will be removed. Set this to true if you want to do a replacement operation for the external_resources - RemoveRemainingExternalResources *bool `json:"remove_remaining_external_resources,omitempty"` - // If set to true, any functionalities tagged on the service that are not included in the given array will be removed. Set this to true if you want to do a replacement operation for the functionalities - RemoveRemainingFunctionalities *bool `json:"remove_remaining_functionalities,omitempty"` - // If set to true, any teams tagged on the service that are not included in the given array will be removed. Set this to true if you want to do a replacement operation for the teams - RemoveRemainingTeams *bool `json:"remove_remaining_teams,omitempty"` - // Integer representing service tier - ServiceTier *PatchV1ServicesServiceIDServiceTier `json:"service_tier,omitempty"` - // An array of teams to attach to this service. - Teams []PatchV1ServicesServiceIDTeams `json:"teams,omitempty"` -} - -func (o *PatchV1ServicesServiceID) GetAlertOnAdd() *bool { - if o == nil { - return nil - } - return o.AlertOnAdd -} - -func (o *PatchV1ServicesServiceID) GetAutoAddRespondingTeam() *bool { - if o == nil { - return nil - } - return o.AutoAddRespondingTeam -} - -func (o *PatchV1ServicesServiceID) GetChecklists() []Checklists { - if o == nil { - return nil - } - return o.Checklists -} - -func (o *PatchV1ServicesServiceID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1ServicesServiceID) GetExternalResources() []PatchV1ServicesServiceIDExternalResources { - if o == nil { - return nil - } - return o.ExternalResources -} - -func (o *PatchV1ServicesServiceID) GetFunctionalities() []PatchV1ServicesServiceIDFunctionalities { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *PatchV1ServicesServiceID) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PatchV1ServicesServiceID) GetLinks() []PatchV1ServicesServiceIDLinks { - if o == nil { - return nil - } - return o.Links -} - -func (o *PatchV1ServicesServiceID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1ServicesServiceID) GetOwner() *PatchV1ServicesServiceIDOwner { - if o == nil { - return nil - } - return o.Owner -} - -func (o *PatchV1ServicesServiceID) GetRemoveOwner() *bool { - if o == nil { - return nil - } - return o.RemoveOwner -} - -func (o *PatchV1ServicesServiceID) GetRemoveRemainingChecklists() *bool { - if o == nil { - return nil - } - return o.RemoveRemainingChecklists -} - -func (o *PatchV1ServicesServiceID) GetRemoveRemainingExternalResources() *bool { - if o == nil { - return nil - } - return o.RemoveRemainingExternalResources -} - -func (o *PatchV1ServicesServiceID) GetRemoveRemainingFunctionalities() *bool { - if o == nil { - return nil - } - return o.RemoveRemainingFunctionalities -} - -func (o *PatchV1ServicesServiceID) GetRemoveRemainingTeams() *bool { - if o == nil { - return nil - } - return o.RemoveRemainingTeams -} - -func (o *PatchV1ServicesServiceID) GetServiceTier() *PatchV1ServicesServiceIDServiceTier { - if o == nil { - return nil - } - return o.ServiceTier -} - -func (o *PatchV1ServicesServiceID) GetTeams() []PatchV1ServicesServiceIDTeams { - if o == nil { - return nil - } - return o.Teams -} diff --git a/internal/sdk/models/shared/patchv1severitiesseverityslug.go b/internal/sdk/models/shared/patchv1severitiesseverityslug.go deleted file mode 100644 index 6cfeb18..0000000 --- a/internal/sdk/models/shared/patchv1severitiesseverityslug.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type PatchV1SeveritiesSeveritySlugColor string - -const ( - PatchV1SeveritiesSeveritySlugColorRed PatchV1SeveritiesSeveritySlugColor = "red" - PatchV1SeveritiesSeveritySlugColorOrange PatchV1SeveritiesSeveritySlugColor = "orange" - PatchV1SeveritiesSeveritySlugColorYellow PatchV1SeveritiesSeveritySlugColor = "yellow" - PatchV1SeveritiesSeveritySlugColorBlue PatchV1SeveritiesSeveritySlugColor = "blue" - PatchV1SeveritiesSeveritySlugColorTeal PatchV1SeveritiesSeveritySlugColor = "teal" - PatchV1SeveritiesSeveritySlugColorGrey PatchV1SeveritiesSeveritySlugColor = "grey" -) - -func (e PatchV1SeveritiesSeveritySlugColor) ToPointer() *PatchV1SeveritiesSeveritySlugColor { - return &e -} -func (e *PatchV1SeveritiesSeveritySlugColor) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "red": - fallthrough - case "orange": - fallthrough - case "yellow": - fallthrough - case "blue": - fallthrough - case "teal": - fallthrough - case "grey": - *e = PatchV1SeveritiesSeveritySlugColor(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1SeveritiesSeveritySlugColor: %v", v) - } -} - -// PatchV1SeveritiesSeveritySlug - Update a specific severity -type PatchV1SeveritiesSeveritySlug struct { - Slug *string `json:"slug,omitempty"` - Description *string `json:"description,omitempty"` - Position *int `json:"position,omitempty"` - Color *PatchV1SeveritiesSeveritySlugColor `json:"color,omitempty"` -} - -func (o *PatchV1SeveritiesSeveritySlug) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PatchV1SeveritiesSeveritySlug) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1SeveritiesSeveritySlug) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *PatchV1SeveritiesSeveritySlug) GetColor() *PatchV1SeveritiesSeveritySlugColor { - if o == nil { - return nil - } - return o.Color -} diff --git a/internal/sdk/models/shared/patchv1severitymatrix.go b/internal/sdk/models/shared/patchv1severitymatrix.go deleted file mode 100644 index a194e7d..0000000 --- a/internal/sdk/models/shared/patchv1severitymatrix.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PatchV1SeverityMatrixData struct { - // Slug of a severity - Severity string `json:"severity"` - // Impact id - ImpactID string `json:"impact_id"` - // Condition id - ConditionID string `json:"condition_id"` -} - -func (o *PatchV1SeverityMatrixData) GetSeverity() string { - if o == nil { - return "" - } - return o.Severity -} - -func (o *PatchV1SeverityMatrixData) GetImpactID() string { - if o == nil { - return "" - } - return o.ImpactID -} - -func (o *PatchV1SeverityMatrixData) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -// PatchV1SeverityMatrix - Update available severities and impacts in your organization's severity matrix. -type PatchV1SeverityMatrix struct { - Summary *string `json:"summary,omitempty"` - Data []PatchV1SeverityMatrixData `json:"data"` -} - -func (o *PatchV1SeverityMatrix) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PatchV1SeverityMatrix) GetData() []PatchV1SeverityMatrixData { - if o == nil { - return []PatchV1SeverityMatrixData{} - } - return o.Data -} diff --git a/internal/sdk/models/shared/patchv1severitymatrixconditionsconditionid.go b/internal/sdk/models/shared/patchv1severitymatrixconditionsconditionid.go deleted file mode 100644 index 52c0adf..0000000 --- a/internal/sdk/models/shared/patchv1severitymatrixconditionsconditionid.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1SeverityMatrixConditionsConditionID - Update a specific condition -type PatchV1SeverityMatrixConditionsConditionID struct { - Name *string `json:"name,omitempty"` - // Position is used to determine ordering of conditions in API responses and dropdowns. The condition with the lowest position (typically 0) will be considered the Default Condition - Position *int `json:"position,omitempty"` -} - -func (o *PatchV1SeverityMatrixConditionsConditionID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1SeverityMatrixConditionsConditionID) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/patchv1severitymatriximpactsimpactid.go b/internal/sdk/models/shared/patchv1severitymatriximpactsimpactid.go deleted file mode 100644 index 4568e42..0000000 --- a/internal/sdk/models/shared/patchv1severitymatriximpactsimpactid.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1SeverityMatrixImpactsImpactID - Update a specific impact -type PatchV1SeverityMatrixImpactsImpactID struct { - Name *string `json:"name,omitempty"` - Position *int `json:"position,omitempty"` -} - -func (o *PatchV1SeverityMatrixImpactsImpactID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1SeverityMatrixImpactsImpactID) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/patchv1signalsemailtargetsid.go b/internal/sdk/models/shared/patchv1signalsemailtargetsid.go deleted file mode 100644 index e298bd1..0000000 --- a/internal/sdk/models/shared/patchv1signalsemailtargetsid.go +++ /dev/null @@ -1,191 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// PatchV1SignalsEmailTargetsIDType - The type of target that the inbound email will notify when matched. -type PatchV1SignalsEmailTargetsIDType string - -const ( - PatchV1SignalsEmailTargetsIDTypeTeam PatchV1SignalsEmailTargetsIDType = "Team" - PatchV1SignalsEmailTargetsIDTypeEntireTeam PatchV1SignalsEmailTargetsIDType = "EntireTeam" - PatchV1SignalsEmailTargetsIDTypeEscalationPolicy PatchV1SignalsEmailTargetsIDType = "EscalationPolicy" - PatchV1SignalsEmailTargetsIDTypeOnCallSchedule PatchV1SignalsEmailTargetsIDType = "OnCallSchedule" - PatchV1SignalsEmailTargetsIDTypeUser PatchV1SignalsEmailTargetsIDType = "User" - PatchV1SignalsEmailTargetsIDTypeSlackChannel PatchV1SignalsEmailTargetsIDType = "SlackChannel" - PatchV1SignalsEmailTargetsIDTypeWebhook PatchV1SignalsEmailTargetsIDType = "Webhook" -) - -func (e PatchV1SignalsEmailTargetsIDType) ToPointer() *PatchV1SignalsEmailTargetsIDType { - return &e -} -func (e *PatchV1SignalsEmailTargetsIDType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "Team": - fallthrough - case "EntireTeam": - fallthrough - case "EscalationPolicy": - fallthrough - case "OnCallSchedule": - fallthrough - case "User": - fallthrough - case "SlackChannel": - fallthrough - case "Webhook": - *e = PatchV1SignalsEmailTargetsIDType(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1SignalsEmailTargetsIDType: %v", v) - } -} - -// PatchV1SignalsEmailTargetsIDTarget - The target that the email target will notify. This object must contain a `type` -// field that specifies the type of target and an `id` field that specifies the ID of -// the target. The `type` field must be one of "escalation_policy", "on_call_schedule", -// "team", "user", or "slack_channel". -type PatchV1SignalsEmailTargetsIDTarget struct { - // The type of target that the inbound email will notify when matched. - Type PatchV1SignalsEmailTargetsIDType `json:"type"` - // The ID of the target that the inbound email will notify when matched. - ID string `json:"id"` -} - -func (o *PatchV1SignalsEmailTargetsIDTarget) GetType() PatchV1SignalsEmailTargetsIDType { - if o == nil { - return PatchV1SignalsEmailTargetsIDType("") - } - return o.Type -} - -func (o *PatchV1SignalsEmailTargetsIDTarget) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -// PatchV1SignalsEmailTargetsIDRuleMatchingStrategy - Whether or not all rules must match, or if only one rule must match. -type PatchV1SignalsEmailTargetsIDRuleMatchingStrategy string - -const ( - PatchV1SignalsEmailTargetsIDRuleMatchingStrategyAll PatchV1SignalsEmailTargetsIDRuleMatchingStrategy = "all" - PatchV1SignalsEmailTargetsIDRuleMatchingStrategyAny PatchV1SignalsEmailTargetsIDRuleMatchingStrategy = "any" -) - -func (e PatchV1SignalsEmailTargetsIDRuleMatchingStrategy) ToPointer() *PatchV1SignalsEmailTargetsIDRuleMatchingStrategy { - return &e -} -func (e *PatchV1SignalsEmailTargetsIDRuleMatchingStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "all": - fallthrough - case "any": - *e = PatchV1SignalsEmailTargetsIDRuleMatchingStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1SignalsEmailTargetsIDRuleMatchingStrategy: %v", v) - } -} - -// PatchV1SignalsEmailTargetsID - Update a Signals email target by ID -type PatchV1SignalsEmailTargetsID struct { - // The email target's name. - Name *string `json:"name,omitempty"` - // The email address that will be listening to events. - Slug *string `json:"slug,omitempty"` - // A detailed description of the email target. - Description *string `json:"description,omitempty"` - // The target that the email target will notify. This object must contain a `type` - // field that specifies the type of target and an `id` field that specifies the ID of - // the target. The `type` field must be one of "escalation_policy", "on_call_schedule", - // "team", "user", or "slack_channel". - // - Target *PatchV1SignalsEmailTargetsIDTarget `json:"target,omitempty"` - // A list of email addresses that are allowed to send events to the target. Must be exact match. - AllowedSenders []string `json:"allowed_senders,omitempty"` - // The CEL expression that defines the status of an incoming email that is sent to the target. - StatusCel *string `json:"status_cel,omitempty"` - // The CEL expression that defines the level of an incoming email that is sent to the target. - LevelCel *string `json:"level_cel,omitempty"` - // A list of CEL expressions that should be evaluated and matched to determine if the target should be notified. - Rules []string `json:"rules,omitempty"` - // Whether or not all rules must match, or if only one rule must match. - RuleMatchingStrategy *PatchV1SignalsEmailTargetsIDRuleMatchingStrategy `json:"rule_matching_strategy,omitempty"` -} - -func (o *PatchV1SignalsEmailTargetsID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1SignalsEmailTargetsID) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PatchV1SignalsEmailTargetsID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1SignalsEmailTargetsID) GetTarget() *PatchV1SignalsEmailTargetsIDTarget { - if o == nil { - return nil - } - return o.Target -} - -func (o *PatchV1SignalsEmailTargetsID) GetAllowedSenders() []string { - if o == nil { - return nil - } - return o.AllowedSenders -} - -func (o *PatchV1SignalsEmailTargetsID) GetStatusCel() *string { - if o == nil { - return nil - } - return o.StatusCel -} - -func (o *PatchV1SignalsEmailTargetsID) GetLevelCel() *string { - if o == nil { - return nil - } - return o.LevelCel -} - -func (o *PatchV1SignalsEmailTargetsID) GetRules() []string { - if o == nil { - return nil - } - return o.Rules -} - -func (o *PatchV1SignalsEmailTargetsID) GetRuleMatchingStrategy() *PatchV1SignalsEmailTargetsIDRuleMatchingStrategy { - if o == nil { - return nil - } - return o.RuleMatchingStrategy -} diff --git a/internal/sdk/models/shared/patchv1signalswebhooktargetsid.go b/internal/sdk/models/shared/patchv1signalswebhooktargetsid.go deleted file mode 100644 index 9d86db0..0000000 --- a/internal/sdk/models/shared/patchv1signalswebhooktargetsid.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1SignalsWebhookTargetsID - Update a Signals webhook target by ID -type PatchV1SignalsWebhookTargetsID struct { - // The webhook target's name. - Name *string `json:"name,omitempty"` - // An optional detailed description of the webhook target. - Description *string `json:"description,omitempty"` - // The URL that the webhook target will notify. - URL *string `json:"url,omitempty"` - // An optional secret we will provide in the `FH-Signature` header - // when sending a payload to the webhook target. This key will not be - // shown in any response once configured. - // - SigningKey *string `json:"signing_key,omitempty"` -} - -func (o *PatchV1SignalsWebhookTargetsID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1SignalsWebhookTargetsID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1SignalsWebhookTargetsID) GetURL() *string { - if o == nil { - return nil - } - return o.URL -} - -func (o *PatchV1SignalsWebhookTargetsID) GetSigningKey() *string { - if o == nil { - return nil - } - return o.SigningKey -} diff --git a/internal/sdk/models/shared/patchv1statusupdatetemplatesstatusupdatetemplateid.go b/internal/sdk/models/shared/patchv1statusupdatetemplatesstatusupdatetemplateid.go deleted file mode 100644 index 0c2e106..0000000 --- a/internal/sdk/models/shared/patchv1statusupdatetemplatesstatusupdatetemplateid.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1StatusUpdateTemplatesStatusUpdateTemplateID - Update a single status update template -type PatchV1StatusUpdateTemplatesStatusUpdateTemplateID struct { - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` -} - -func (o *PatchV1StatusUpdateTemplatesStatusUpdateTemplateID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1StatusUpdateTemplatesStatusUpdateTemplateID) GetBody() *string { - if o == nil { - return nil - } - return o.Body -} diff --git a/internal/sdk/models/shared/patchv1taskliststasklistid.go b/internal/sdk/models/shared/patchv1taskliststasklistid.go deleted file mode 100644 index 2c648e9..0000000 --- a/internal/sdk/models/shared/patchv1taskliststasklistid.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PatchV1TaskListsTaskListIDTaskListItems struct { - // A summary of the task - Summary string `json:"summary"` - // A long-form description for the task if additional context is helpful - Description *string `json:"description,omitempty"` -} - -func (o *PatchV1TaskListsTaskListIDTaskListItems) GetSummary() string { - if o == nil { - return "" - } - return o.Summary -} - -func (o *PatchV1TaskListsTaskListIDTaskListItems) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -// PatchV1TaskListsTaskListID - Updates a task list's attributes and task list items -type PatchV1TaskListsTaskListID struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - TaskListItems []PatchV1TaskListsTaskListIDTaskListItems `json:"task_list_items,omitempty"` -} - -func (o *PatchV1TaskListsTaskListID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1TaskListsTaskListID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1TaskListsTaskListID) GetTaskListItems() []PatchV1TaskListsTaskListIDTaskListItems { - if o == nil { - return nil - } - return o.TaskListItems -} diff --git a/internal/sdk/models/shared/patchv1teamsteamid.go b/internal/sdk/models/shared/patchv1teamsteamid.go deleted file mode 100644 index 07a7783..0000000 --- a/internal/sdk/models/shared/patchv1teamsteamid.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1TeamsTeamIDMsTeamsChannel - MS Teams channel identity for channel associated with this team -type PatchV1TeamsTeamIDMsTeamsChannel struct { - ChannelID string `json:"channel_id"` - MsTeamID string `json:"ms_team_id"` -} - -func (o *PatchV1TeamsTeamIDMsTeamsChannel) GetChannelID() string { - if o == nil { - return "" - } - return o.ChannelID -} - -func (o *PatchV1TeamsTeamIDMsTeamsChannel) GetMsTeamID() string { - if o == nil { - return "" - } - return o.MsTeamID -} - -type PatchV1TeamsTeamIDMemberships struct { - UserID *string `json:"user_id,omitempty"` - ScheduleID *string `json:"schedule_id,omitempty"` - // An incident role ID that this user will automatically assigned if this team is assigned to an incident - IncidentRoleID *string `json:"incident_role_id,omitempty"` -} - -func (o *PatchV1TeamsTeamIDMemberships) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -func (o *PatchV1TeamsTeamIDMemberships) GetScheduleID() *string { - if o == nil { - return nil - } - return o.ScheduleID -} - -func (o *PatchV1TeamsTeamIDMemberships) GetIncidentRoleID() *string { - if o == nil { - return nil - } - return o.IncidentRoleID -} - -// PatchV1TeamsTeamID - Update a single team from its ID -type PatchV1TeamsTeamID struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Slug *string `json:"slug,omitempty"` - // The Slack channel ID that this team is associated with - SlackChannelID *string `json:"slack_channel_id,omitempty"` - // MS Teams channel identity for channel associated with this team - MsTeamsChannel *PatchV1TeamsTeamIDMsTeamsChannel `json:"ms_teams_channel,omitempty"` - Memberships []PatchV1TeamsTeamIDMemberships `json:"memberships,omitempty"` -} - -func (o *PatchV1TeamsTeamID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1TeamsTeamID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1TeamsTeamID) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PatchV1TeamsTeamID) GetSlackChannelID() *string { - if o == nil { - return nil - } - return o.SlackChannelID -} - -func (o *PatchV1TeamsTeamID) GetMsTeamsChannel() *PatchV1TeamsTeamIDMsTeamsChannel { - if o == nil { - return nil - } - return o.MsTeamsChannel -} - -func (o *PatchV1TeamsTeamID) GetMemberships() []PatchV1TeamsTeamIDMemberships { - if o == nil { - return nil - } - return o.Memberships -} diff --git a/internal/sdk/models/shared/patchv1teamsteamidescalationpoliciesid.go b/internal/sdk/models/shared/patchv1teamsteamidescalationpoliciesid.go deleted file mode 100644 index 08b805b..0000000 --- a/internal/sdk/models/shared/patchv1teamsteamidescalationpoliciesid.go +++ /dev/null @@ -1,205 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" -) - -// PatchV1TeamsTeamIDEscalationPoliciesIDType - The type of target that the step will notify. -type PatchV1TeamsTeamIDEscalationPoliciesIDType string - -const ( - PatchV1TeamsTeamIDEscalationPoliciesIDTypeOnCallSchedule PatchV1TeamsTeamIDEscalationPoliciesIDType = "OnCallSchedule" - PatchV1TeamsTeamIDEscalationPoliciesIDTypeUser PatchV1TeamsTeamIDEscalationPoliciesIDType = "User" - PatchV1TeamsTeamIDEscalationPoliciesIDTypeSlackChannel PatchV1TeamsTeamIDEscalationPoliciesIDType = "SlackChannel" - PatchV1TeamsTeamIDEscalationPoliciesIDTypeEntireTeam PatchV1TeamsTeamIDEscalationPoliciesIDType = "EntireTeam" - PatchV1TeamsTeamIDEscalationPoliciesIDTypeWebhook PatchV1TeamsTeamIDEscalationPoliciesIDType = "Webhook" -) - -func (e PatchV1TeamsTeamIDEscalationPoliciesIDType) ToPointer() *PatchV1TeamsTeamIDEscalationPoliciesIDType { - return &e -} -func (e *PatchV1TeamsTeamIDEscalationPoliciesIDType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "OnCallSchedule": - fallthrough - case "User": - fallthrough - case "SlackChannel": - fallthrough - case "EntireTeam": - fallthrough - case "Webhook": - *e = PatchV1TeamsTeamIDEscalationPoliciesIDType(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1TeamsTeamIDEscalationPoliciesIDType: %v", v) - } -} - -type PatchV1TeamsTeamIDEscalationPoliciesIDTargets struct { - // The type of target that the step will notify. - Type PatchV1TeamsTeamIDEscalationPoliciesIDType `json:"type"` - // The ID of the target that the step will notify. - ID string `json:"id"` -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDTargets) GetType() PatchV1TeamsTeamIDEscalationPoliciesIDType { - if o == nil { - return PatchV1TeamsTeamIDEscalationPoliciesIDType("") - } - return o.Type -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDTargets) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type PatchV1TeamsTeamIDEscalationPoliciesIDSteps struct { - // A list of targets that the step will notify. You can specify up to 15 targets per step. - Targets []PatchV1TeamsTeamIDEscalationPoliciesIDTargets `json:"targets,omitempty"` - // An ISO8601 duration string specifying how long to wait before moving on to the next step. For the last step, this value specifies how long to wait before the escalation policy should repeat, if it repeats. - Timeout string `json:"timeout"` -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDSteps) GetTargets() []PatchV1TeamsTeamIDEscalationPoliciesIDTargets { - if o == nil { - return nil - } - return o.Targets -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDSteps) GetTimeout() string { - if o == nil { - return "" - } - return o.Timeout -} - -// PatchV1TeamsTeamIDEscalationPoliciesIDTargetType - The type of target to which the policy will hand off. -type PatchV1TeamsTeamIDEscalationPoliciesIDTargetType string - -const ( - PatchV1TeamsTeamIDEscalationPoliciesIDTargetTypeEscalationPolicy PatchV1TeamsTeamIDEscalationPoliciesIDTargetType = "EscalationPolicy" - PatchV1TeamsTeamIDEscalationPoliciesIDTargetTypeTeam PatchV1TeamsTeamIDEscalationPoliciesIDTargetType = "Team" -) - -func (e PatchV1TeamsTeamIDEscalationPoliciesIDTargetType) ToPointer() *PatchV1TeamsTeamIDEscalationPoliciesIDTargetType { - return &e -} -func (e *PatchV1TeamsTeamIDEscalationPoliciesIDTargetType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "EscalationPolicy": - fallthrough - case "Team": - *e = PatchV1TeamsTeamIDEscalationPoliciesIDTargetType(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1TeamsTeamIDEscalationPoliciesIDTargetType: %v", v) - } -} - -// PatchV1TeamsTeamIDEscalationPoliciesIDHandoffStep - A step that defines where an alert should be sent when the policy is exhausted and the alert is still unacknowledged. -type PatchV1TeamsTeamIDEscalationPoliciesIDHandoffStep struct { - // The type of target to which the policy will hand off. - TargetType PatchV1TeamsTeamIDEscalationPoliciesIDTargetType `json:"target_type"` - // The ID of the target to which the policy will hand off. - TargetID string `json:"target_id"` -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDHandoffStep) GetTargetType() PatchV1TeamsTeamIDEscalationPoliciesIDTargetType { - if o == nil { - return PatchV1TeamsTeamIDEscalationPoliciesIDTargetType("") - } - return o.TargetType -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesIDHandoffStep) GetTargetID() string { - if o == nil { - return "" - } - return o.TargetID -} - -// PatchV1TeamsTeamIDEscalationPoliciesID - Update a Signals escalation policy by ID -type PatchV1TeamsTeamIDEscalationPoliciesID struct { - // The escalation policy's name. - Name *string `json:"name,omitempty"` - // A detailed description of the escalation policy. - Description *string `json:"description,omitempty"` - // The number of times that the escalation policy should repeat before an alert is dropped. - Repetitions *int `default:"0" json:"repetitions"` - // Whether this escalation policy should be the default for the team. - Default *bool `default:"false" json:"default"` - // A list of steps that define how an alert should escalate through the policy. - Steps []PatchV1TeamsTeamIDEscalationPoliciesIDSteps `json:"steps,omitempty"` - // A step that defines where an alert should be sent when the policy is exhausted and the alert is still unacknowledged. - HandoffStep *PatchV1TeamsTeamIDEscalationPoliciesIDHandoffStep `json:"handoff_step,omitempty"` -} - -func (p PatchV1TeamsTeamIDEscalationPoliciesID) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PatchV1TeamsTeamIDEscalationPoliciesID) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesID) GetRepetitions() *int { - if o == nil { - return nil - } - return o.Repetitions -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesID) GetDefault() *bool { - if o == nil { - return nil - } - return o.Default -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesID) GetSteps() []PatchV1TeamsTeamIDEscalationPoliciesIDSteps { - if o == nil { - return nil - } - return o.Steps -} - -func (o *PatchV1TeamsTeamIDEscalationPoliciesID) GetHandoffStep() *PatchV1TeamsTeamIDEscalationPoliciesIDHandoffStep { - if o == nil { - return nil - } - return o.HandoffStep -} diff --git a/internal/sdk/models/shared/patchv1teamsteamidoncallschedulesscheduleid.go b/internal/sdk/models/shared/patchv1teamsteamidoncallschedulesscheduleid.go deleted file mode 100644 index f9c3cac..0000000 --- a/internal/sdk/models/shared/patchv1teamsteamidoncallschedulesscheduleid.go +++ /dev/null @@ -1,355 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDMembers struct { - // The ID of a user who should be added to the schedule's rotation. You can add a user to the schedule - // multiple times to construct more complex rotations, and you can specify a `null` user ID to create - // unassigned slots in the rotation. - // - UserID *string `json:"user_id,omitempty"` -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDMembers) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -// PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType - The type of strategy. Must be one of "daily", "weekly", or "custom". -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType string - -const ( - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDTypeDaily PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType = "daily" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDTypeWeekly PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType = "weekly" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDTypeCustom PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType = "custom" -) - -func (e PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType) ToPointer() *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType { - return &e -} -func (e *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "daily": - fallthrough - case "weekly": - fallthrough - case "custom": - *e = PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType: %v", v) - } -} - -// PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay - The day of the week on which on-call shifts should hand off, as its long-form name (e.g. "monday", "tuesday", etc). This value is only used if the strategy type is "weekly". -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay string - -const ( - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDayMonday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay = "monday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDayTuesday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay = "tuesday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDayWednesday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay = "wednesday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDayThursday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay = "thursday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDayFriday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay = "friday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDaySaturday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay = "saturday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDaySunday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay = "sunday" -) - -func (e PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay) ToPointer() *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay { - return &e -} -func (e *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "monday": - fallthrough - case "tuesday": - fallthrough - case "wednesday": - fallthrough - case "thursday": - fallthrough - case "friday": - fallthrough - case "saturday": - fallthrough - case "sunday": - *e = PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay: %v", v) - } -} - -// PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStrategy - An object that specifies how the schedule's on-call shifts should be generated. -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStrategy struct { - // The type of strategy. Must be one of "daily", "weekly", or "custom". - Type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType `json:"type"` - // An ISO8601 time string specifying when on-call shifts should hand off. This value is only used if the strategy type is "daily" or "weekly". - HandoffTime *string `json:"handoff_time,omitempty"` - // The day of the week on which on-call shifts should hand off, as its long-form name (e.g. "monday", "tuesday", etc). This value is only used if the strategy type is "weekly". - HandoffDay *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay `json:"handoff_day,omitempty"` - // An ISO8601 duration string specifying how long each shift should last. This value is only used if the strategy type is "custom". - ShiftDuration *string `json:"shift_duration,omitempty"` -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStrategy) GetType() PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType { - if o == nil { - return PatchV1TeamsTeamIDOnCallSchedulesScheduleIDType("") - } - return o.Type -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStrategy) GetHandoffTime() *string { - if o == nil { - return nil - } - return o.HandoffTime -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStrategy) GetHandoffDay() *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDHandoffDay { - if o == nil { - return nil - } - return o.HandoffDay -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStrategy) GetShiftDuration() *string { - if o == nil { - return nil - } - return o.ShiftDuration -} - -// PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay - The day of the week on which the restriction should start, as its long-form name (e.g. "monday", "tuesday", etc). -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay string - -const ( - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDayMonday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay = "monday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDayTuesday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay = "tuesday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDayWednesday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay = "wednesday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDayThursday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay = "thursday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDayFriday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay = "friday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDaySaturday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay = "saturday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDaySunday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay = "sunday" -) - -func (e PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay) ToPointer() *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay { - return &e -} -func (e *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "monday": - fallthrough - case "tuesday": - fallthrough - case "wednesday": - fallthrough - case "thursday": - fallthrough - case "friday": - fallthrough - case "saturday": - fallthrough - case "sunday": - *e = PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay: %v", v) - } -} - -// PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay - The day of the week on which the restriction should end, as its long-form name (e.g. "monday", "tuesday", etc). -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay string - -const ( - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDayMonday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay = "monday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDayTuesday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay = "tuesday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDayWednesday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay = "wednesday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDayThursday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay = "thursday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDayFriday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay = "friday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDaySaturday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay = "saturday" - PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDaySunday PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay = "sunday" -) - -func (e PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay) ToPointer() *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay { - return &e -} -func (e *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "monday": - fallthrough - case "tuesday": - fallthrough - case "wednesday": - fallthrough - case "thursday": - fallthrough - case "friday": - fallthrough - case "saturday": - fallthrough - case "sunday": - *e = PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay: %v", v) - } -} - -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRestrictions struct { - // The day of the week on which the restriction should start, as its long-form name (e.g. "monday", "tuesday", etc). - StartDay PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay `json:"start_day"` - // An ISO8601 time string specifying when the restriction should start. - StartTime string `json:"start_time"` - // The day of the week on which the restriction should end, as its long-form name (e.g. "monday", "tuesday", etc). - EndDay PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay `json:"end_day"` - // An ISO8601 time string specifying when the restriction should end. - EndTime string `json:"end_time"` -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRestrictions) GetStartDay() PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay { - if o == nil { - return PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStartDay("") - } - return o.StartDay -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRestrictions) GetStartTime() string { - if o == nil { - return "" - } - return o.StartTime -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRestrictions) GetEndDay() PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay { - if o == nil { - return PatchV1TeamsTeamIDOnCallSchedulesScheduleIDEndDay("") - } - return o.EndDay -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRestrictions) GetEndTime() string { - if o == nil { - return "" - } - return o.EndTime -} - -// PatchV1TeamsTeamIDOnCallSchedulesScheduleID - Update a Signals on-call schedule by ID -type PatchV1TeamsTeamIDOnCallSchedulesScheduleID struct { - // The on-call schedule's name. - Name *string `json:"name,omitempty"` - // A detailed description of the on-call schedule. - Description *string `json:"description,omitempty"` - // The time zone in which the on-call schedule operates. This value must be a valid IANA time zone name. - TimeZone *string `json:"time_zone,omitempty"` - // The ID of a Slack user group for syncing purposes. If provided, we will automatically sync whoever is on call to the user group in Slack. - SlackUserGroupID *string `json:"slack_user_group_id,omitempty"` - // An ordered list of objects that specify members of the on-call schedule's rotation. - Members []PatchV1TeamsTeamIDOnCallSchedulesScheduleIDMembers `json:"members,omitempty"` - // An object that specifies how the schedule's on-call shifts should be generated. - Strategy *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStrategy `json:"strategy,omitempty"` - // A list of objects that restrict the schedule to speccific on-call periods. - Restrictions []PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRestrictions `json:"restrictions,omitempty"` - // An ISO8601 time string specifying when the updated schedule should take effect. This - // value must be provided if editing an attribute that would affect how the schedule's - // shifts are generated, such as the time zone, members, strategy, or restrictions. - // - EffectiveAt *string `json:"effective_at,omitempty"` - // A hex color code that will be used to represent the schedule in the UI and iCal subscriptions. - Color *string `json:"color,omitempty"` - // This parameter is deprecated; use `members` instead. - MemberIds []string `json:"member_ids,omitempty"` -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetTimeZone() *string { - if o == nil { - return nil - } - return o.TimeZone -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetSlackUserGroupID() *string { - if o == nil { - return nil - } - return o.SlackUserGroupID -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetMembers() []PatchV1TeamsTeamIDOnCallSchedulesScheduleIDMembers { - if o == nil { - return nil - } - return o.Members -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetStrategy() *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDStrategy { - if o == nil { - return nil - } - return o.Strategy -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetRestrictions() []PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRestrictions { - if o == nil { - return nil - } - return o.Restrictions -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetEffectiveAt() *string { - if o == nil { - return nil - } - return o.EffectiveAt -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetColor() *string { - if o == nil { - return nil - } - return o.Color -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleID) GetMemberIds() []string { - if o == nil { - return nil - } - return o.MemberIds -} diff --git a/internal/sdk/models/shared/patchv1teamsteamidoncallschedulesscheduleidshiftsid.go b/internal/sdk/models/shared/patchv1teamsteamidoncallschedulesscheduleidshiftsid.go deleted file mode 100644 index d860446..0000000 --- a/internal/sdk/models/shared/patchv1teamsteamidoncallschedulesscheduleidshiftsid.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID - Update a Signals on-call shift by ID -type PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID struct { - // The start time of the shift in ISO8601 format. - StartTime *string `json:"start_time,omitempty"` - // The end time of the shift in ISO8601 format. - EndTime *string `json:"end_time,omitempty"` - // The ID of the user who is on-call for the shift. If not provided, the shift will be unassigned. - UserID *string `json:"user_id,omitempty"` - // A description of why coverage is needed for this shift. If the shift is re-assigned, this will automatically be cleared unless provided again. - CoverageRequest *string `json:"coverage_request,omitempty"` -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID) GetStartTime() *string { - if o == nil { - return nil - } - return o.StartTime -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID) GetEndTime() *string { - if o == nil { - return nil - } - return o.EndTime -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -func (o *PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID) GetCoverageRequest() *string { - if o == nil { - return nil - } - return o.CoverageRequest -} diff --git a/internal/sdk/models/shared/patchv1teamsteamidsignalrulesid.go b/internal/sdk/models/shared/patchv1teamsteamidsignalrulesid.go deleted file mode 100644 index 5241eb9..0000000 --- a/internal/sdk/models/shared/patchv1teamsteamidsignalrulesid.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// PatchV1TeamsTeamIDSignalRulesIDTargetType - The type of target that the rule will notify when matched. -type PatchV1TeamsTeamIDSignalRulesIDTargetType string - -const ( - PatchV1TeamsTeamIDSignalRulesIDTargetTypeEscalationPolicy PatchV1TeamsTeamIDSignalRulesIDTargetType = "EscalationPolicy" - PatchV1TeamsTeamIDSignalRulesIDTargetTypeOnCallSchedule PatchV1TeamsTeamIDSignalRulesIDTargetType = "OnCallSchedule" - PatchV1TeamsTeamIDSignalRulesIDTargetTypeUser PatchV1TeamsTeamIDSignalRulesIDTargetType = "User" - PatchV1TeamsTeamIDSignalRulesIDTargetTypeWebhook PatchV1TeamsTeamIDSignalRulesIDTargetType = "Webhook" -) - -func (e PatchV1TeamsTeamIDSignalRulesIDTargetType) ToPointer() *PatchV1TeamsTeamIDSignalRulesIDTargetType { - return &e -} -func (e *PatchV1TeamsTeamIDSignalRulesIDTargetType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "EscalationPolicy": - fallthrough - case "OnCallSchedule": - fallthrough - case "User": - fallthrough - case "Webhook": - *e = PatchV1TeamsTeamIDSignalRulesIDTargetType(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1TeamsTeamIDSignalRulesIDTargetType: %v", v) - } -} - -// PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride - A notification priority that will be set on the resulting alert (default: HIGH) -type PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride string - -const ( - PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverrideHigh PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride = "HIGH" - PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverrideMedium PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride = "MEDIUM" - PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverrideLow PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride = "LOW" - PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverrideUnknown PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride = "" -) - -func (e PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride) ToPointer() *PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride { - return &e -} -func (e *PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "HIGH": - fallthrough - case "MEDIUM": - fallthrough - case "LOW": - fallthrough - case "": - *e = PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride: %v", v) - } -} - -// PatchV1TeamsTeamIDSignalRulesID - Update a Signals rule by ID -type PatchV1TeamsTeamIDSignalRulesID struct { - // The rule's name. - Name *string `json:"name,omitempty"` - // The CEL expression that defines the rule. - Expression *string `json:"expression,omitempty"` - // The type of target that the rule will notify when matched. - TargetType *PatchV1TeamsTeamIDSignalRulesIDTargetType `json:"target_type,omitempty"` - // The ID of the target that the rule will notify when matched. - TargetID *string `json:"target_id,omitempty"` - // The ID of an incident type that should be used when an alert is promoted to an incident - IncidentTypeID *string `json:"incident_type_id,omitempty"` - // A notification priority that will be set on the resulting alert (default: HIGH) - NotificationPriorityOverride *PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride `json:"notification_priority_override,omitempty"` -} - -func (o *PatchV1TeamsTeamIDSignalRulesID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1TeamsTeamIDSignalRulesID) GetExpression() *string { - if o == nil { - return nil - } - return o.Expression -} - -func (o *PatchV1TeamsTeamIDSignalRulesID) GetTargetType() *PatchV1TeamsTeamIDSignalRulesIDTargetType { - if o == nil { - return nil - } - return o.TargetType -} - -func (o *PatchV1TeamsTeamIDSignalRulesID) GetTargetID() *string { - if o == nil { - return nil - } - return o.TargetID -} - -func (o *PatchV1TeamsTeamIDSignalRulesID) GetIncidentTypeID() *string { - if o == nil { - return nil - } - return o.IncidentTypeID -} - -func (o *PatchV1TeamsTeamIDSignalRulesID) GetNotificationPriorityOverride() *PatchV1TeamsTeamIDSignalRulesIDNotificationPriorityOverride { - if o == nil { - return nil - } - return o.NotificationPriorityOverride -} diff --git a/internal/sdk/models/shared/patchv1ticketingprioritiesid.go b/internal/sdk/models/shared/patchv1ticketingprioritiesid.go deleted file mode 100644 index 1193b91..0000000 --- a/internal/sdk/models/shared/patchv1ticketingprioritiesid.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1TicketingPrioritiesID - Update a single ticketing priority's attributes -type PatchV1TicketingPrioritiesID struct { - Name *string `json:"name,omitempty"` - // The position that this priority should take in your list of priorities. Priorities should be ordered from highest to lowest, with the highest priority at 0. If a position isn't specified, the new priority will be added to the end of the list; if another priority already exists at the specified position, this priority will shift that priority and all priorities down the list. - Position *int `json:"position,omitempty"` -} - -func (o *PatchV1TicketingPrioritiesID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PatchV1TicketingPrioritiesID) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/patchv1ticketingticketsticketid.go b/internal/sdk/models/shared/patchv1ticketingticketsticketid.go deleted file mode 100644 index 3f1c92e..0000000 --- a/internal/sdk/models/shared/patchv1ticketingticketsticketid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PatchV1TicketingTicketsTicketID - Update a ticket's attributes -type PatchV1TicketingTicketsTicketID struct { - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - State *string `json:"state,omitempty"` - Type *string `json:"type,omitempty"` - PriorityID *string `json:"priority_id,omitempty"` - // List of tags for the ticket - TagList []string `json:"tag_list,omitempty"` -} - -func (o *PatchV1TicketingTicketsTicketID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PatchV1TicketingTicketsTicketID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PatchV1TicketingTicketsTicketID) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *PatchV1TicketingTicketsTicketID) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *PatchV1TicketingTicketsTicketID) GetPriorityID() *string { - if o == nil { - return nil - } - return o.PriorityID -} - -func (o *PatchV1TicketingTicketsTicketID) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} diff --git a/internal/sdk/models/shared/patchv1webhookswebhookid.go b/internal/sdk/models/shared/patchv1webhookswebhookid.go deleted file mode 100644 index 38a4d38..0000000 --- a/internal/sdk/models/shared/patchv1webhookswebhookid.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type PatchV1WebhooksWebhookIDState string - -const ( - PatchV1WebhooksWebhookIDStateActive PatchV1WebhooksWebhookIDState = "active" - PatchV1WebhooksWebhookIDStateInactive PatchV1WebhooksWebhookIDState = "inactive" -) - -func (e PatchV1WebhooksWebhookIDState) ToPointer() *PatchV1WebhooksWebhookIDState { - return &e -} -func (e *PatchV1WebhooksWebhookIDState) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "active": - fallthrough - case "inactive": - *e = PatchV1WebhooksWebhookIDState(v) - return nil - default: - return fmt.Errorf("invalid value for PatchV1WebhooksWebhookIDState: %v", v) - } -} - -// PatchV1WebhooksWebhookID - Update a specific webhook -type PatchV1WebhooksWebhookID struct { - URL *string `json:"url,omitempty"` - State *PatchV1WebhooksWebhookIDState `json:"state,omitempty"` -} - -func (o *PatchV1WebhooksWebhookID) GetURL() *string { - if o == nil { - return nil - } - return o.URL -} - -func (o *PatchV1WebhooksWebhookID) GetState() *PatchV1WebhooksWebhookIDState { - if o == nil { - return nil - } - return o.State -} diff --git a/internal/sdk/models/shared/pongentity.go b/internal/sdk/models/shared/pongentity.go deleted file mode 100644 index 1d8bb5e..0000000 --- a/internal/sdk/models/shared/pongentity.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PongEntity model -type PongEntity struct { - Response *string `json:"response,omitempty"` - Actor *ActorEntity `json:"actor,omitempty"` - Organization *OrganizationEntity `json:"organization,omitempty"` -} - -func (o *PongEntity) GetResponse() *string { - if o == nil { - return nil - } - return o.Response -} - -func (o *PongEntity) GetActor() *ActorEntity { - if o == nil { - return nil - } - return o.Actor -} - -func (o *PongEntity) GetOrganization() *OrganizationEntity { - if o == nil { - return nil - } - return o.Organization -} diff --git a/internal/sdk/models/shared/postmortemspostmortemreportentity.go b/internal/sdk/models/shared/postmortemspostmortemreportentity.go deleted file mode 100644 index 9251581..0000000 --- a/internal/sdk/models/shared/postmortemspostmortemreportentity.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// PostMortemsPostMortemReportEntity - PostMortems_PostMortemReportEntity model -type PostMortemsPostMortemReportEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - IncidentID *string `json:"incident_id,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - TagList []string `json:"tag_list,omitempty"` - AdditionalDetails []string `json:"additional_details,omitempty"` - // IncidentEntity model - Incident *IncidentEntity `json:"incident,omitempty"` - Questions *PostMortemsQuestionEntity `json:"questions,omitempty"` - CalendarEvents *CalendarsEventEntity `json:"calendar_events,omitempty"` -} - -func (p PostMortemsPostMortemReportEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PostMortemsPostMortemReportEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PostMortemsPostMortemReportEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PostMortemsPostMortemReportEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PostMortemsPostMortemReportEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PostMortemsPostMortemReportEntity) GetIncidentID() *string { - if o == nil { - return nil - } - return o.IncidentID -} - -func (o *PostMortemsPostMortemReportEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *PostMortemsPostMortemReportEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *PostMortemsPostMortemReportEntity) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} - -func (o *PostMortemsPostMortemReportEntity) GetAdditionalDetails() []string { - if o == nil { - return nil - } - return o.AdditionalDetails -} - -func (o *PostMortemsPostMortemReportEntity) GetIncident() *IncidentEntity { - if o == nil { - return nil - } - return o.Incident -} - -func (o *PostMortemsPostMortemReportEntity) GetQuestions() *PostMortemsQuestionEntity { - if o == nil { - return nil - } - return o.Questions -} - -func (o *PostMortemsPostMortemReportEntity) GetCalendarEvents() *CalendarsEventEntity { - if o == nil { - return nil - } - return o.CalendarEvents -} diff --git a/internal/sdk/models/shared/postmortemspostmortemreportentitypaginated.go b/internal/sdk/models/shared/postmortemspostmortemreportentitypaginated.go deleted file mode 100644 index 65ac8eb..0000000 --- a/internal/sdk/models/shared/postmortemspostmortemreportentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostMortemsPostMortemReportEntityPaginated - PostMortems_PostMortemReportEntityPaginated model -type PostMortemsPostMortemReportEntityPaginated struct { - Data []PostMortemsPostMortemReportEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *PostMortemsPostMortemReportEntityPaginated) GetData() []PostMortemsPostMortemReportEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *PostMortemsPostMortemReportEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/postmortemsquestionentity.go b/internal/sdk/models/shared/postmortemsquestionentity.go deleted file mode 100644 index 4c6a4a7..0000000 --- a/internal/sdk/models/shared/postmortemsquestionentity.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PostMortemsQuestionEntity struct { - ID *string `json:"id,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - Tooltip *string `json:"tooltip,omitempty"` - Kind *string `json:"kind,omitempty"` - QuestionTypeID *string `json:"question_type_id,omitempty"` - IsRequired *bool `json:"is_required,omitempty"` - AvailableOptions []string `json:"available_options,omitempty"` - Conversations []ConversationsAPIEntitiesReference `json:"conversations,omitempty"` -} - -func (o *PostMortemsQuestionEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PostMortemsQuestionEntity) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *PostMortemsQuestionEntity) GetBody() *string { - if o == nil { - return nil - } - return o.Body -} - -func (o *PostMortemsQuestionEntity) GetTooltip() *string { - if o == nil { - return nil - } - return o.Tooltip -} - -func (o *PostMortemsQuestionEntity) GetKind() *string { - if o == nil { - return nil - } - return o.Kind -} - -func (o *PostMortemsQuestionEntity) GetQuestionTypeID() *string { - if o == nil { - return nil - } - return o.QuestionTypeID -} - -func (o *PostMortemsQuestionEntity) GetIsRequired() *bool { - if o == nil { - return nil - } - return o.IsRequired -} - -func (o *PostMortemsQuestionEntity) GetAvailableOptions() []string { - if o == nil { - return nil - } - return o.AvailableOptions -} - -func (o *PostMortemsQuestionEntity) GetConversations() []ConversationsAPIEntitiesReference { - if o == nil { - return nil - } - return o.Conversations -} diff --git a/internal/sdk/models/shared/postmortemsquestiontypeentity.go b/internal/sdk/models/shared/postmortemsquestiontypeentity.go deleted file mode 100644 index ca11c97..0000000 --- a/internal/sdk/models/shared/postmortemsquestiontypeentity.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostMortemsQuestionTypeEntity - PostMortems_QuestionTypeEntity model -type PostMortemsQuestionTypeEntity struct { - ID *string `json:"id,omitempty"` - Title *string `json:"title,omitempty"` - Tooltip *string `json:"tooltip,omitempty"` - Kind *string `json:"kind,omitempty"` - IsRequired *bool `json:"is_required,omitempty"` - AvailableOptions []string `json:"available_options,omitempty"` -} - -func (o *PostMortemsQuestionTypeEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PostMortemsQuestionTypeEntity) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *PostMortemsQuestionTypeEntity) GetTooltip() *string { - if o == nil { - return nil - } - return o.Tooltip -} - -func (o *PostMortemsQuestionTypeEntity) GetKind() *string { - if o == nil { - return nil - } - return o.Kind -} - -func (o *PostMortemsQuestionTypeEntity) GetIsRequired() *bool { - if o == nil { - return nil - } - return o.IsRequired -} - -func (o *PostMortemsQuestionTypeEntity) GetAvailableOptions() []string { - if o == nil { - return nil - } - return o.AvailableOptions -} diff --git a/internal/sdk/models/shared/postmortemsquestiontypeentitypaginated.go b/internal/sdk/models/shared/postmortemsquestiontypeentitypaginated.go deleted file mode 100644 index c23d32a..0000000 --- a/internal/sdk/models/shared/postmortemsquestiontypeentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostMortemsQuestionTypeEntityPaginated - PostMortems_QuestionTypeEntityPaginated model -type PostMortemsQuestionTypeEntityPaginated struct { - Data []PostMortemsQuestionTypeEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *PostMortemsQuestionTypeEntityPaginated) GetData() []PostMortemsQuestionTypeEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *PostMortemsQuestionTypeEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/postmortemsreasonentity.go b/internal/sdk/models/shared/postmortemsreasonentity.go deleted file mode 100644 index 2d564ac..0000000 --- a/internal/sdk/models/shared/postmortemsreasonentity.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostMortemsReasonEntity - PostMortems_ReasonEntity model -type PostMortemsReasonEntity struct { - ID *string `json:"id,omitempty"` - Summary *string `json:"summary,omitempty"` - Position *int `json:"position,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - Conversations []ConversationsAPIEntitiesReference `json:"conversations,omitempty"` -} - -func (o *PostMortemsReasonEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PostMortemsReasonEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PostMortemsReasonEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *PostMortemsReasonEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *PostMortemsReasonEntity) GetConversations() []ConversationsAPIEntitiesReference { - if o == nil { - return nil - } - return o.Conversations -} diff --git a/internal/sdk/models/shared/postmortemsreasonentitypaginated.go b/internal/sdk/models/shared/postmortemsreasonentitypaginated.go deleted file mode 100644 index 3cfbbf4..0000000 --- a/internal/sdk/models/shared/postmortemsreasonentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostMortemsReasonEntityPaginated - PostMortems_ReasonEntityPaginated model -type PostMortemsReasonEntityPaginated struct { - Data []PostMortemsReasonEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *PostMortemsReasonEntityPaginated) GetData() []PostMortemsReasonEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *PostMortemsReasonEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/postmortemssectionfieldentity.go b/internal/sdk/models/shared/postmortemssectionfieldentity.go deleted file mode 100644 index 722f0e4..0000000 --- a/internal/sdk/models/shared/postmortemssectionfieldentity.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostMortemsSectionFieldEntity - PostMortems_SectionFieldEntity model -type PostMortemsSectionFieldEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -func (o *PostMortemsSectionFieldEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PostMortemsSectionFieldEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PostMortemsSectionFieldEntity) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} diff --git a/internal/sdk/models/shared/postv1catalogscatalogidingest.go b/internal/sdk/models/shared/postv1catalogscatalogidingest.go deleted file mode 100644 index 1266dd6..0000000 --- a/internal/sdk/models/shared/postv1catalogscatalogidingest.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// Encoding for submitted data -type Encoding string - -const ( - EncodingTextYaml Encoding = "text/yaml" - EncodingApplicationXYaml Encoding = "application/x-yaml" - EncodingApplicationJSON Encoding = "application/json" -) - -func (e Encoding) ToPointer() *Encoding { - return &e -} -func (e *Encoding) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "text/yaml": - fallthrough - case "application/x-yaml": - fallthrough - case "application/json": - *e = Encoding(v) - return nil - default: - return fmt.Errorf("invalid value for Encoding: %v", v) - } -} - -// PostV1CatalogsCatalogIDIngest - Accepts catalog data in the configured format and asyncronously processes the data to incorporate changes into service catalog. -type PostV1CatalogsCatalogIDIngest struct { - // Encoding for submitted data - Encoding Encoding `json:"encoding"` - // Service data - Data string `json:"data"` -} - -func (o *PostV1CatalogsCatalogIDIngest) GetEncoding() Encoding { - if o == nil { - return Encoding("") - } - return o.Encoding -} - -func (o *PostV1CatalogsCatalogIDIngest) GetData() string { - if o == nil { - return "" - } - return o.Data -} diff --git a/internal/sdk/models/shared/postv1changes.go b/internal/sdk/models/shared/postv1changes.go deleted file mode 100644 index 93996e3..0000000 --- a/internal/sdk/models/shared/postv1changes.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1Changes - Create a new change entry -type PostV1Changes struct { - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - // A labels hash of keys and values - Labels map[string]string `json:"labels,omitempty"` -} - -func (o *PostV1Changes) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PostV1Changes) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1Changes) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} diff --git a/internal/sdk/models/shared/postv1changeschangeididentities.go b/internal/sdk/models/shared/postv1changeschangeididentities.go deleted file mode 100644 index 5c28ca3..0000000 --- a/internal/sdk/models/shared/postv1changeschangeididentities.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1ChangesChangeIDIdentities - Create an identity for this change -type PostV1ChangesChangeIDIdentities struct { - Type string `json:"type"` - Value string `json:"value"` -} - -func (o *PostV1ChangesChangeIDIdentities) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *PostV1ChangesChangeIDIdentities) GetValue() string { - if o == nil { - return "" - } - return o.Value -} diff --git a/internal/sdk/models/shared/postv1changesevents.go b/internal/sdk/models/shared/postv1changesevents.go deleted file mode 100644 index 286c816..0000000 --- a/internal/sdk/models/shared/postv1changesevents.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type ChangeIdentities struct { - Type string `json:"type"` - Value string `json:"value"` -} - -func (o *ChangeIdentities) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *ChangeIdentities) GetValue() string { - if o == nil { - return "" - } - return o.Value -} - -type PostV1ChangesEventsType string - -const ( - PostV1ChangesEventsTypeLink PostV1ChangesEventsType = "link" -) - -func (e PostV1ChangesEventsType) ToPointer() *PostV1ChangesEventsType { - return &e -} -func (e *PostV1ChangesEventsType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "link": - *e = PostV1ChangesEventsType(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1ChangesEventsType: %v", v) - } -} - -type Attachments struct { - Type PostV1ChangesEventsType `json:"type"` -} - -func (o *Attachments) GetType() PostV1ChangesEventsType { - if o == nil { - return PostV1ChangesEventsType("") - } - return o.Type -} - -type Authors struct { - Source string `json:"source"` - SourceID string `json:"source_id"` - Name string `json:"name"` -} - -func (o *Authors) GetSource() string { - if o == nil { - return "" - } - return o.Source -} - -func (o *Authors) GetSourceID() string { - if o == nil { - return "" - } - return o.SourceID -} - -func (o *Authors) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -// PostV1ChangesEvents - Create a change event -type PostV1ChangesEvents struct { - Summary string `json:"summary"` - Description *string `json:"description,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - StartsAt *time.Time `json:"starts_at,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` - // An array of environment IDs - Environments []string `json:"environments,omitempty"` - // An array of service IDs - Services []string `json:"services,omitempty"` - // An array of change IDs - Changes []string `json:"changes,omitempty"` - // The ID of a change event as assigned by an external provider - ExternalID *string `json:"external_id,omitempty"` - // If provided and valid, the event will be linked to all changes that have the same identities. Identity *values* must be unique. - ChangeIdentities []ChangeIdentities `json:"change_identities,omitempty"` - // JSON objects representing attachments, see attachments documentation for the schema - Attachments []Attachments `json:"attachments,omitempty"` - // Array of additional authors to add to the change event, the creating actor will automatically be added as an author - Authors []Authors `json:"authors,omitempty"` -} - -func (p PostV1ChangesEvents) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PostV1ChangesEvents) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PostV1ChangesEvents) GetSummary() string { - if o == nil { - return "" - } - return o.Summary -} - -func (o *PostV1ChangesEvents) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1ChangesEvents) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PostV1ChangesEvents) GetStartsAt() *time.Time { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *PostV1ChangesEvents) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *PostV1ChangesEvents) GetEnvironments() []string { - if o == nil { - return nil - } - return o.Environments -} - -func (o *PostV1ChangesEvents) GetServices() []string { - if o == nil { - return nil - } - return o.Services -} - -func (o *PostV1ChangesEvents) GetChanges() []string { - if o == nil { - return nil - } - return o.Changes -} - -func (o *PostV1ChangesEvents) GetExternalID() *string { - if o == nil { - return nil - } - return o.ExternalID -} - -func (o *PostV1ChangesEvents) GetChangeIdentities() []ChangeIdentities { - if o == nil { - return nil - } - return o.ChangeIdentities -} - -func (o *PostV1ChangesEvents) GetAttachments() []Attachments { - if o == nil { - return nil - } - return o.Attachments -} - -func (o *PostV1ChangesEvents) GetAuthors() []Authors { - if o == nil { - return nil - } - return o.Authors -} diff --git a/internal/sdk/models/shared/postv1checklisttemplates.go b/internal/sdk/models/shared/postv1checklisttemplates.go deleted file mode 100644 index 28aa705..0000000 --- a/internal/sdk/models/shared/postv1checklisttemplates.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type Checks struct { - // The name of the check - Name string `json:"name"` - // The description of the check - Description *string `json:"description,omitempty"` -} - -func (o *Checks) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *Checks) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -type ConnectedServices struct { - ID string `json:"id"` -} - -func (o *ConnectedServices) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -// PostV1ChecklistTemplates - Creates a checklist template for the organization -type PostV1ChecklistTemplates struct { - Name string `json:"name"` - // An array of checks for the checklist template - Checks []Checks `json:"checks"` - Description *string `json:"description,omitempty"` - // The ID of the Team that owns the checklist template - TeamID *string `json:"team_id,omitempty"` - // Array of service IDs to attach checklist template to - ConnectedServices []ConnectedServices `json:"connected_services,omitempty"` -} - -func (o *PostV1ChecklistTemplates) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1ChecklistTemplates) GetChecks() []Checks { - if o == nil { - return []Checks{} - } - return o.Checks -} - -func (o *PostV1ChecklistTemplates) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1ChecklistTemplates) GetTeamID() *string { - if o == nil { - return nil - } - return o.TeamID -} - -func (o *PostV1ChecklistTemplates) GetConnectedServices() []ConnectedServices { - if o == nil { - return nil - } - return o.ConnectedServices -} diff --git a/internal/sdk/models/shared/postv1conversationsconversationidcomments.go b/internal/sdk/models/shared/postv1conversationsconversationidcomments.go deleted file mode 100644 index d34e15e..0000000 --- a/internal/sdk/models/shared/postv1conversationsconversationidcomments.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1ConversationsConversationIDComments - ALPHA - Creates a comment for a project -type PostV1ConversationsConversationIDComments struct { - // Text body of comment - Body string `json:"body"` -} - -func (o *PostV1ConversationsConversationIDComments) GetBody() string { - if o == nil { - return "" - } - return o.Body -} diff --git a/internal/sdk/models/shared/postv1conversationsconversationidcommentscommentidreactions.go b/internal/sdk/models/shared/postv1conversationsconversationidcommentscommentidreactions.go deleted file mode 100644 index f5b7158..0000000 --- a/internal/sdk/models/shared/postv1conversationsconversationidcommentscommentidreactions.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1ConversationsConversationIDCommentsCommentIDReactions - ALPHA - Create a reaction on a comment -type PostV1ConversationsConversationIDCommentsCommentIDReactions struct { - // CLDR short name of Unicode emojis - Reaction string `json:"reaction"` -} - -func (o *PostV1ConversationsConversationIDCommentsCommentIDReactions) GetReaction() string { - if o == nil { - return "" - } - return o.Reaction -} diff --git a/internal/sdk/models/shared/postv1customfieldsdefinitions.go b/internal/sdk/models/shared/postv1customfieldsdefinitions.go deleted file mode 100644 index 3d89a5f..0000000 --- a/internal/sdk/models/shared/postv1customfieldsdefinitions.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1CustomFieldsDefinitions - Create a new custom field definition -type PostV1CustomFieldsDefinitions struct { - DisplayName string `json:"display_name"` - Description *string `json:"description,omitempty"` - FieldType string `json:"field_type"` - PermissibleValues []string `json:"permissible_values,omitempty"` - Required bool `json:"required"` - // An optional milestone ID to specify when the field should become required, if `required` is set to `true`. If not provided, required fields are always required. - RequiredAtMilestoneID *string `json:"required_at_milestone_id,omitempty"` -} - -func (o *PostV1CustomFieldsDefinitions) GetDisplayName() string { - if o == nil { - return "" - } - return o.DisplayName -} - -func (o *PostV1CustomFieldsDefinitions) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1CustomFieldsDefinitions) GetFieldType() string { - if o == nil { - return "" - } - return o.FieldType -} - -func (o *PostV1CustomFieldsDefinitions) GetPermissibleValues() []string { - if o == nil { - return nil - } - return o.PermissibleValues -} - -func (o *PostV1CustomFieldsDefinitions) GetRequired() bool { - if o == nil { - return false - } - return o.Required -} - -func (o *PostV1CustomFieldsDefinitions) GetRequiredAtMilestoneID() *string { - if o == nil { - return nil - } - return o.RequiredAtMilestoneID -} diff --git a/internal/sdk/models/shared/postv1environments.go b/internal/sdk/models/shared/postv1environments.go deleted file mode 100644 index 7d0ab8e..0000000 --- a/internal/sdk/models/shared/postv1environments.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1Environments - Creates an environment for the organization -type PostV1Environments struct { - Name string `json:"name"` - Description *string `json:"description,omitempty"` -} - -func (o *PostV1Environments) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1Environments) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} diff --git a/internal/sdk/models/shared/postv1functionalities.go b/internal/sdk/models/shared/postv1functionalities.go deleted file mode 100644 index 6062d8c..0000000 --- a/internal/sdk/models/shared/postv1functionalities.go +++ /dev/null @@ -1,177 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type Services struct { - // ID of a service - ID string `json:"id"` -} - -func (o *Services) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type PostV1FunctionalitiesExternalResources struct { - RemoteID string `json:"remote_id"` - // The integration slug for the external resource. Can be one of: github, opsgenie, pager_duty, statuspage, victorops. Not required if the resource has already been imported. - ConnectionType *string `json:"connection_type,omitempty"` -} - -func (o *PostV1FunctionalitiesExternalResources) GetRemoteID() string { - if o == nil { - return "" - } - return o.RemoteID -} - -func (o *PostV1FunctionalitiesExternalResources) GetConnectionType() *string { - if o == nil { - return nil - } - return o.ConnectionType -} - -type PostV1FunctionalitiesLinks struct { - // Short name used to display and identify this link - Name string `json:"name"` - // URL - HrefURL string `json:"href_url"` - // An optional URL to an icon representing this link - IconURL *string `json:"icon_url,omitempty"` -} - -func (o *PostV1FunctionalitiesLinks) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1FunctionalitiesLinks) GetHrefURL() string { - if o == nil { - return "" - } - return o.HrefURL -} - -func (o *PostV1FunctionalitiesLinks) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -// PostV1FunctionalitiesOwner - An object representing a Team that owns the service -type PostV1FunctionalitiesOwner struct { - ID string `json:"id"` -} - -func (o *PostV1FunctionalitiesOwner) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type PostV1FunctionalitiesTeams struct { - ID string `json:"id"` -} - -func (o *PostV1FunctionalitiesTeams) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -// PostV1Functionalities - Creates a functionality for the organization -type PostV1Functionalities struct { - Name string `json:"name"` - Description *string `json:"description,omitempty"` - Services []Services `json:"services,omitempty"` - // A hash of label keys and values - Labels map[string]string `json:"labels,omitempty"` - AlertOnAdd *bool `json:"alert_on_add,omitempty"` - AutoAddRespondingTeam *bool `json:"auto_add_responding_team,omitempty"` - // An array of external resources to attach to this service. - ExternalResources []PostV1FunctionalitiesExternalResources `json:"external_resources,omitempty"` - // An array of links to associate with this service - Links []PostV1FunctionalitiesLinks `json:"links,omitempty"` - // An object representing a Team that owns the service - Owner *PostV1FunctionalitiesOwner `json:"owner,omitempty"` - // An array of teams to attach to this service. - Teams []PostV1FunctionalitiesTeams `json:"teams,omitempty"` -} - -func (o *PostV1Functionalities) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1Functionalities) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1Functionalities) GetServices() []Services { - if o == nil { - return nil - } - return o.Services -} - -func (o *PostV1Functionalities) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PostV1Functionalities) GetAlertOnAdd() *bool { - if o == nil { - return nil - } - return o.AlertOnAdd -} - -func (o *PostV1Functionalities) GetAutoAddRespondingTeam() *bool { - if o == nil { - return nil - } - return o.AutoAddRespondingTeam -} - -func (o *PostV1Functionalities) GetExternalResources() []PostV1FunctionalitiesExternalResources { - if o == nil { - return nil - } - return o.ExternalResources -} - -func (o *PostV1Functionalities) GetLinks() []PostV1FunctionalitiesLinks { - if o == nil { - return nil - } - return o.Links -} - -func (o *PostV1Functionalities) GetOwner() *PostV1FunctionalitiesOwner { - if o == nil { - return nil - } - return o.Owner -} - -func (o *PostV1Functionalities) GetTeams() []PostV1FunctionalitiesTeams { - if o == nil { - return nil - } - return o.Teams -} diff --git a/internal/sdk/models/shared/postv1incidentroles.go b/internal/sdk/models/shared/postv1incidentroles.go deleted file mode 100644 index 480ae8d..0000000 --- a/internal/sdk/models/shared/postv1incidentroles.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentRoles - Create a new incident role -type PostV1IncidentRoles struct { - Name string `json:"name"` - Summary string `json:"summary"` - Description *string `json:"description,omitempty"` -} - -func (o *PostV1IncidentRoles) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1IncidentRoles) GetSummary() string { - if o == nil { - return "" - } - return o.Summary -} - -func (o *PostV1IncidentRoles) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} diff --git a/internal/sdk/models/shared/postv1incidents.go b/internal/sdk/models/shared/postv1incidents.go deleted file mode 100644 index 1252e4f..0000000 --- a/internal/sdk/models/shared/postv1incidents.go +++ /dev/null @@ -1,276 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type Impacts struct { - // The type of impacted infrastructure. One of: environment, functionality, or service - Type string `json:"type"` - // The ID of the impacted infrastructure - ID string `json:"id"` - // The ID of the impact condition. Find these at /v1/severity_matrix/conditions - ConditionID string `json:"condition_id"` -} - -func (o *Impacts) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *Impacts) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *Impacts) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -type Milestones struct { - // The type/slug of the milestone. Must be one of the currently configured milestones. - Type string `json:"type"` - // An ISO8601 formatted string for when this milestone occurred. If you are removing a milestone, this field still needs to be set to some value - OccurredAt time.Time `json:"occurred_at"` -} - -func (m Milestones) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(m, "", false) -} - -func (m *Milestones) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil { - return err - } - return nil -} - -func (o *Milestones) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *Milestones) GetOccurredAt() time.Time { - if o == nil { - return time.Time{} - } - return o.OccurredAt -} - -type CustomFields struct { - // The ID of the custom field you wish to set. - FieldID string `json:"field_id"` - // The value you wish to set on the custom field if the type of the field accepts string values - ValueString *string `json:"value_string,omitempty"` - // The value you wish to set on the custom field if the type of the field accepts array values - ValueArray []string `json:"value_array,omitempty"` -} - -func (o *CustomFields) GetFieldID() string { - if o == nil { - return "" - } - return o.FieldID -} - -func (o *CustomFields) GetValueString() *string { - if o == nil { - return nil - } - return o.ValueString -} - -func (o *CustomFields) GetValueArray() []string { - if o == nil { - return nil - } - return o.ValueArray -} - -// PostV1Incidents - Create a new incident -type PostV1Incidents struct { - Name string `json:"name"` - Summary *string `json:"summary,omitempty"` - CustomerImpactSummary *string `json:"customer_impact_summary,omitempty"` - Description *string `json:"description,omitempty"` - Priority *string `json:"priority,omitempty"` - Severity *string `json:"severity,omitempty"` - SeverityConditionID *string `json:"severity_condition_id,omitempty"` - SeverityImpactID *string `json:"severity_impact_id,omitempty"` - // List of alert IDs that this incident should be associated to - AlertIds []string `json:"alert_ids,omitempty"` - // Key:value pairs to track custom data for the incident - Labels map[string]string `json:"labels,omitempty"` - // List of ids of Runbooks to attach to this incident. Foregoes any conditions these Runbooks may have guarding automatic attachment. - RunbookIds []string `json:"runbook_ids,omitempty"` - // List of tags for the incident - TagList []string `json:"tag_list,omitempty"` - // An array of impacted infrastructure - Impacts []Impacts `json:"impacts,omitempty"` - // An array of milestones to set on an incident. This can be used to create an already-resolved incident. - Milestones []Milestones `json:"milestones,omitempty"` - Restricted *bool `json:"restricted,omitempty"` - // IDs of teams you wish to assign to this incident. - TeamIds []string `json:"team_ids,omitempty"` - // An array of custom fields to set on the incident. - CustomFields []CustomFields `json:"custom_fields,omitempty"` - ExternalLinks *string `json:"external_links,omitempty"` - // If true, the incident type values will not be copied to the incident. This is useful when creating an incident from an incident type, but you want to set the values manually. - SkipIncidentTypeValues *bool `default:"false" json:"skip_incident_type_values"` -} - -func (p PostV1Incidents) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PostV1Incidents) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PostV1Incidents) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1Incidents) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PostV1Incidents) GetCustomerImpactSummary() *string { - if o == nil { - return nil - } - return o.CustomerImpactSummary -} - -func (o *PostV1Incidents) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1Incidents) GetPriority() *string { - if o == nil { - return nil - } - return o.Priority -} - -func (o *PostV1Incidents) GetSeverity() *string { - if o == nil { - return nil - } - return o.Severity -} - -func (o *PostV1Incidents) GetSeverityConditionID() *string { - if o == nil { - return nil - } - return o.SeverityConditionID -} - -func (o *PostV1Incidents) GetSeverityImpactID() *string { - if o == nil { - return nil - } - return o.SeverityImpactID -} - -func (o *PostV1Incidents) GetAlertIds() []string { - if o == nil { - return nil - } - return o.AlertIds -} - -func (o *PostV1Incidents) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PostV1Incidents) GetRunbookIds() []string { - if o == nil { - return nil - } - return o.RunbookIds -} - -func (o *PostV1Incidents) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} - -func (o *PostV1Incidents) GetImpacts() []Impacts { - if o == nil { - return nil - } - return o.Impacts -} - -func (o *PostV1Incidents) GetMilestones() []Milestones { - if o == nil { - return nil - } - return o.Milestones -} - -func (o *PostV1Incidents) GetRestricted() *bool { - if o == nil { - return nil - } - return o.Restricted -} - -func (o *PostV1Incidents) GetTeamIds() []string { - if o == nil { - return nil - } - return o.TeamIds -} - -func (o *PostV1Incidents) GetCustomFields() []CustomFields { - if o == nil { - return nil - } - return o.CustomFields -} - -func (o *PostV1Incidents) GetExternalLinks() *string { - if o == nil { - return nil - } - return o.ExternalLinks -} - -func (o *PostV1Incidents) GetSkipIncidentTypeValues() *bool { - if o == nil { - return nil - } - return o.SkipIncidentTypeValues -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidgenericchatmessages.go b/internal/sdk/models/shared/postv1incidentsincidentidgenericchatmessages.go deleted file mode 100644 index d4bd483..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidgenericchatmessages.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type VoteDirection string - -const ( - VoteDirectionUp VoteDirection = "up" - VoteDirectionDown VoteDirection = "down" -) - -func (e VoteDirection) ToPointer() *VoteDirection { - return &e -} -func (e *VoteDirection) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "up": - fallthrough - case "down": - *e = VoteDirection(v) - return nil - default: - return fmt.Errorf("invalid value for VoteDirection: %v", v) - } -} - -// PostV1IncidentsIncidentIDGenericChatMessages - Create a new generic chat message on an incident timeline. These are independent of any specific chat provider. -type PostV1IncidentsIncidentIDGenericChatMessages struct { - Body string `json:"body"` - // ISO8601 timestamp for when the chat message occurred - OccurredAt *time.Time `json:"occurred_at,omitempty"` - VoteDirection *VoteDirection `json:"vote_direction,omitempty"` -} - -func (p PostV1IncidentsIncidentIDGenericChatMessages) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PostV1IncidentsIncidentIDGenericChatMessages) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessages) GetBody() string { - if o == nil { - return "" - } - return o.Body -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessages) GetOccurredAt() *time.Time { - if o == nil { - return nil - } - return o.OccurredAt -} - -func (o *PostV1IncidentsIncidentIDGenericChatMessages) GetVoteDirection() *VoteDirection { - if o == nil { - return nil - } - return o.VoteDirection -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidimpacttype.go b/internal/sdk/models/shared/postv1incidentsincidentidimpacttype.go deleted file mode 100644 index 6e93bcf..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidimpacttype.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentsIncidentIDImpactType - Add impacted infrastructure to an incident -type PostV1IncidentsIncidentIDImpactType struct { - ID string `json:"id"` - ConditionID *string `json:"condition_id,omitempty"` -} - -func (o *PostV1IncidentsIncidentIDImpactType) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PostV1IncidentsIncidentIDImpactType) GetConditionID() *string { - if o == nil { - return nil - } - return o.ConditionID -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidlinks.go b/internal/sdk/models/shared/postv1incidentsincidentidlinks.go deleted file mode 100644 index 7d76c6e..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidlinks.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentsIncidentIDLinks - Allows adding adhoc links to an incident as an attachment -type PostV1IncidentsIncidentIDLinks struct { - DisplayText *string `json:"display_text,omitempty"` - IconURL *string `json:"icon_url,omitempty"` - Href string `json:"href"` -} - -func (o *PostV1IncidentsIncidentIDLinks) GetDisplayText() *string { - if o == nil { - return nil - } - return o.DisplayText -} - -func (o *PostV1IncidentsIncidentIDLinks) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -func (o *PostV1IncidentsIncidentIDLinks) GetHref() string { - if o == nil { - return "" - } - return o.Href -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidnotes.go b/internal/sdk/models/shared/postv1incidentsincidentidnotes.go deleted file mode 100644 index 91c0c95..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidnotes.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type PostV1IncidentsIncidentIDNotesVisibility string - -const ( - PostV1IncidentsIncidentIDNotesVisibilityPrivateToOrg PostV1IncidentsIncidentIDNotesVisibility = "private_to_org" - PostV1IncidentsIncidentIDNotesVisibilityOpenToPublic PostV1IncidentsIncidentIDNotesVisibility = "open_to_public" - PostV1IncidentsIncidentIDNotesVisibilityInternalStatusPage PostV1IncidentsIncidentIDNotesVisibility = "internal_status_page" -) - -func (e PostV1IncidentsIncidentIDNotesVisibility) ToPointer() *PostV1IncidentsIncidentIDNotesVisibility { - return &e -} -func (e *PostV1IncidentsIncidentIDNotesVisibility) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "private_to_org": - fallthrough - case "open_to_public": - fallthrough - case "internal_status_page": - *e = PostV1IncidentsIncidentIDNotesVisibility(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1IncidentsIncidentIDNotesVisibility: %v", v) - } -} - -type PostV1IncidentsIncidentIDNotesStatusPages struct { - ID string `json:"id"` - IntegrationSlug string `json:"integration_slug"` -} - -func (o *PostV1IncidentsIncidentIDNotesStatusPages) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PostV1IncidentsIncidentIDNotesStatusPages) GetIntegrationSlug() string { - if o == nil { - return "" - } - return o.IntegrationSlug -} - -// PostV1IncidentsIncidentIDNotes - Create a new note on for an incident. The visibility field on a note determines where it gets posted. -type PostV1IncidentsIncidentIDNotes struct { - Body string `json:"body"` - // ISO8601 timestamp for when the note occurred - OccurredAt *time.Time `json:"occurred_at,omitempty"` - Visibility *PostV1IncidentsIncidentIDNotesVisibility `default:"private_to_org" json:"visibility"` - StatusPages []PostV1IncidentsIncidentIDNotesStatusPages `json:"status_pages,omitempty"` -} - -func (p PostV1IncidentsIncidentIDNotes) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PostV1IncidentsIncidentIDNotes) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PostV1IncidentsIncidentIDNotes) GetBody() string { - if o == nil { - return "" - } - return o.Body -} - -func (o *PostV1IncidentsIncidentIDNotes) GetOccurredAt() *time.Time { - if o == nil { - return nil - } - return o.OccurredAt -} - -func (o *PostV1IncidentsIncidentIDNotes) GetVisibility() *PostV1IncidentsIncidentIDNotesVisibility { - if o == nil { - return nil - } - return o.Visibility -} - -func (o *PostV1IncidentsIncidentIDNotes) GetStatusPages() []PostV1IncidentsIncidentIDNotesStatusPages { - if o == nil { - return nil - } - return o.StatusPages -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidrelatedchangeevents.go b/internal/sdk/models/shared/postv1incidentsincidentidrelatedchangeevents.go deleted file mode 100644 index 79895f6..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidrelatedchangeevents.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type PostV1IncidentsIncidentIDRelatedChangeEventsType string - -const ( - PostV1IncidentsIncidentIDRelatedChangeEventsTypeCaused PostV1IncidentsIncidentIDRelatedChangeEventsType = "caused" - PostV1IncidentsIncidentIDRelatedChangeEventsTypeFixed PostV1IncidentsIncidentIDRelatedChangeEventsType = "fixed" - PostV1IncidentsIncidentIDRelatedChangeEventsTypeSuspect PostV1IncidentsIncidentIDRelatedChangeEventsType = "suspect" - PostV1IncidentsIncidentIDRelatedChangeEventsTypeDismissed PostV1IncidentsIncidentIDRelatedChangeEventsType = "dismissed" -) - -func (e PostV1IncidentsIncidentIDRelatedChangeEventsType) ToPointer() *PostV1IncidentsIncidentIDRelatedChangeEventsType { - return &e -} -func (e *PostV1IncidentsIncidentIDRelatedChangeEventsType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "caused": - fallthrough - case "fixed": - fallthrough - case "suspect": - fallthrough - case "dismissed": - *e = PostV1IncidentsIncidentIDRelatedChangeEventsType(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1IncidentsIncidentIDRelatedChangeEventsType: %v", v) - } -} - -// PostV1IncidentsIncidentIDRelatedChangeEvents - Add a related change to an incident. Changes added to an incident can be causes, fixes, or suspects. To remove a change from an incident, the type field should be set to dismissed. -type PostV1IncidentsIncidentIDRelatedChangeEvents struct { - // The ID of the change event to associate - ChangeEventID string `json:"change_event_id"` - Type PostV1IncidentsIncidentIDRelatedChangeEventsType `json:"type"` - // A short description about why this change event is related - Why *string `json:"why,omitempty"` -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEvents) GetChangeEventID() string { - if o == nil { - return "" - } - return o.ChangeEventID -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEvents) GetType() PostV1IncidentsIncidentIDRelatedChangeEventsType { - if o == nil { - return PostV1IncidentsIncidentIDRelatedChangeEventsType("") - } - return o.Type -} - -func (o *PostV1IncidentsIncidentIDRelatedChangeEvents) GetWhy() *string { - if o == nil { - return nil - } - return o.Why -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidroleassignments.go b/internal/sdk/models/shared/postv1incidentsincidentidroleassignments.go deleted file mode 100644 index bc76583..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidroleassignments.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentsIncidentIDRoleAssignments - Assign a role to a user for this incident -type PostV1IncidentsIncidentIDRoleAssignments struct { - // The user ID to assign the role to - UserID string `json:"user_id"` - // The Incident Role ID to assign the role to - IncidentRoleID string `json:"incident_role_id"` -} - -func (o *PostV1IncidentsIncidentIDRoleAssignments) GetUserID() string { - if o == nil { - return "" - } - return o.UserID -} - -func (o *PostV1IncidentsIncidentIDRoleAssignments) GetIncidentRoleID() string { - if o == nil { - return "" - } - return o.IncidentRoleID -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidstatuspages.go b/internal/sdk/models/shared/postv1incidentsincidentidstatuspages.go deleted file mode 100644 index 0e45dc5..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidstatuspages.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentsIncidentIDStatusPages - Add a status page to an incident. -type PostV1IncidentsIncidentIDStatusPages struct { - IntegrationSlug string `json:"integration_slug"` - IntegrationID string `json:"integration_id"` - Title *string `json:"title,omitempty"` -} - -func (o *PostV1IncidentsIncidentIDStatusPages) GetIntegrationSlug() string { - if o == nil { - return "" - } - return o.IntegrationSlug -} - -func (o *PostV1IncidentsIncidentIDStatusPages) GetIntegrationID() string { - if o == nil { - return "" - } - return o.IntegrationID -} - -func (o *PostV1IncidentsIncidentIDStatusPages) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidtasklists.go b/internal/sdk/models/shared/postv1incidentsincidentidtasklists.go deleted file mode 100644 index 576fdcf..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidtasklists.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentsIncidentIDTaskLists - Add all tasks from list to incident -type PostV1IncidentsIncidentIDTaskLists struct { - // The id of the task list. - TaskListID string `json:"task_list_id"` - // The ID of the user assigned to the tasks in this list. - AssigneeID *string `json:"assignee_id,omitempty"` -} - -func (o *PostV1IncidentsIncidentIDTaskLists) GetTaskListID() string { - if o == nil { - return "" - } - return o.TaskListID -} - -func (o *PostV1IncidentsIncidentIDTaskLists) GetAssigneeID() *string { - if o == nil { - return nil - } - return o.AssigneeID -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidtasks.go b/internal/sdk/models/shared/postv1incidentsincidentidtasks.go deleted file mode 100644 index ce4c774..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidtasks.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentsIncidentIDTasks - Create a task -type PostV1IncidentsIncidentIDTasks struct { - // The title of the task. - Title string `json:"title"` - // The state of the task. One of: open, in_progress, cancelled, done - State *string `json:"state,omitempty"` - // A description of what the task is for. - Description *string `json:"description,omitempty"` - // The ID of the user assigned to the task. - AssigneeID *string `json:"assignee_id,omitempty"` - // The due date of the task. Relative values are supported such as '5m' - DueAt *string `json:"due_at,omitempty"` -} - -func (o *PostV1IncidentsIncidentIDTasks) GetTitle() string { - if o == nil { - return "" - } - return o.Title -} - -func (o *PostV1IncidentsIncidentIDTasks) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *PostV1IncidentsIncidentIDTasks) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1IncidentsIncidentIDTasks) GetAssigneeID() *string { - if o == nil { - return nil - } - return o.AssigneeID -} - -func (o *PostV1IncidentsIncidentIDTasks) GetDueAt() *string { - if o == nil { - return nil - } - return o.DueAt -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidtaskstaskidconvert.go b/internal/sdk/models/shared/postv1incidentsincidentidtaskstaskidconvert.go deleted file mode 100644 index 40ecaba..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidtaskstaskidconvert.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentsIncidentIDTasksTaskIDConvert - Convert a task to a follow-up -type PostV1IncidentsIncidentIDTasksTaskIDConvert struct { - Summary *string `json:"summary,omitempty"` - ProjectID *string `json:"project_id,omitempty"` - Description *string `json:"description,omitempty"` - State *string `json:"state,omitempty"` - // List of tags for the ticket - TagList []string `json:"tag_list,omitempty"` -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvert) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvert) GetProjectID() *string { - if o == nil { - return nil - } - return o.ProjectID -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvert) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvert) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *PostV1IncidentsIncidentIDTasksTaskIDConvert) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} diff --git a/internal/sdk/models/shared/postv1incidentsincidentidteamassignments.go b/internal/sdk/models/shared/postv1incidentsincidentidteamassignments.go deleted file mode 100644 index a648519..0000000 --- a/internal/sdk/models/shared/postv1incidentsincidentidteamassignments.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1IncidentsIncidentIDTeamAssignments - Assign a team for this incident -type PostV1IncidentsIncidentIDTeamAssignments struct { - // The team ID to associate to the incident - TeamID string `json:"team_id"` -} - -func (o *PostV1IncidentsIncidentIDTeamAssignments) GetTeamID() string { - if o == nil { - return "" - } - return o.TeamID -} diff --git a/internal/sdk/models/shared/postv1incidenttypes.go b/internal/sdk/models/shared/postv1incidenttypes.go deleted file mode 100644 index d08177c..0000000 --- a/internal/sdk/models/shared/postv1incidenttypes.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PostV1IncidentTypesImpacts struct { - // The id of impact - ID string `json:"id"` - // The id of the condition - ConditionID string `json:"condition_id"` -} - -func (o *PostV1IncidentTypesImpacts) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PostV1IncidentTypesImpacts) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -type Template struct { - Description *string `json:"description,omitempty"` - CustomerImpactSummary *string `json:"customer_impact_summary,omitempty"` - // A labels hash of keys and values - Labels map[string]string `json:"labels,omitempty"` - Severity *string `json:"severity,omitempty"` - Priority *string `json:"priority,omitempty"` - // List of tags for the incident - TagList []string `json:"tag_list,omitempty"` - // List of ids of Runbooks to attach to incidents created from this type - RunbookIds []string `json:"runbook_ids,omitempty"` - PrivateIncident *bool `json:"private_incident,omitempty"` - // List of ids of teams to be assigned to incidents - TeamIds []string `json:"team_ids,omitempty"` - // An array of impact/condition combinations - Impacts []PostV1IncidentTypesImpacts `json:"impacts,omitempty"` -} - -func (o *Template) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *Template) GetCustomerImpactSummary() *string { - if o == nil { - return nil - } - return o.CustomerImpactSummary -} - -func (o *Template) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *Template) GetSeverity() *string { - if o == nil { - return nil - } - return o.Severity -} - -func (o *Template) GetPriority() *string { - if o == nil { - return nil - } - return o.Priority -} - -func (o *Template) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} - -func (o *Template) GetRunbookIds() []string { - if o == nil { - return nil - } - return o.RunbookIds -} - -func (o *Template) GetPrivateIncident() *bool { - if o == nil { - return nil - } - return o.PrivateIncident -} - -func (o *Template) GetTeamIds() []string { - if o == nil { - return nil - } - return o.TeamIds -} - -func (o *Template) GetImpacts() []PostV1IncidentTypesImpacts { - if o == nil { - return nil - } - return o.Impacts -} - -// PostV1IncidentTypes - Create a new incident type -type PostV1IncidentTypes struct { - Name string `json:"name"` - Template Template `json:"template"` -} - -func (o *PostV1IncidentTypes) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1IncidentTypes) GetTemplate() Template { - if o == nil { - return Template{} - } - return o.Template -} diff --git a/internal/sdk/models/shared/postv1nuncsubscriptions.go b/internal/sdk/models/shared/postv1nuncsubscriptions.go deleted file mode 100644 index 8940c8b..0000000 --- a/internal/sdk/models/shared/postv1nuncsubscriptions.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1NuncSubscriptions - Subscribe to status page updates -type PostV1NuncSubscriptions struct { - Email string `json:"email"` -} - -func (o *PostV1NuncSubscriptions) GetEmail() string { - if o == nil { - return "" - } - return o.Email -} diff --git a/internal/sdk/models/shared/postv1postmortemsreports.go b/internal/sdk/models/shared/postv1postmortemsreports.go deleted file mode 100644 index d8a768b..0000000 --- a/internal/sdk/models/shared/postv1postmortemsreports.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1PostMortemsReports - Create a report -type PostV1PostMortemsReports struct { - IncidentID string `json:"incident_id"` -} - -func (o *PostV1PostMortemsReports) GetIncidentID() string { - if o == nil { - return "" - } - return o.IncidentID -} diff --git a/internal/sdk/models/shared/postv1postmortemsreportsreportidpublish.go b/internal/sdk/models/shared/postv1postmortemsreportsreportidpublish.go deleted file mode 100644 index a863f2d..0000000 --- a/internal/sdk/models/shared/postv1postmortemsreportsreportidpublish.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type Underscore string - -const ( - UnderscoreTrue Underscore = "true" -) - -func (e Underscore) ToPointer() *Underscore { - return &e -} -func (e *Underscore) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "true": - *e = Underscore(v) - return nil - default: - return fmt.Errorf("invalid value for Underscore: %v", v) - } -} - -// PostV1PostMortemsReportsReportIDPublish - Marks an incident retrospective as published and emails all of the participants in the report the summary -type PostV1PostMortemsReportsReportIDPublish struct { - Underscore *Underscore `json:"_,omitempty"` - // An array of user IDs with whom to share the report - UserIds []string `json:"user_ids,omitempty"` - // An array of team IDs with whom to share the report - TeamIds []string `json:"team_ids,omitempty"` -} - -func (o *PostV1PostMortemsReportsReportIDPublish) GetUnderscore() *Underscore { - if o == nil { - return nil - } - return o.Underscore -} - -func (o *PostV1PostMortemsReportsReportIDPublish) GetUserIds() []string { - if o == nil { - return nil - } - return o.UserIds -} - -func (o *PostV1PostMortemsReportsReportIDPublish) GetTeamIds() []string { - if o == nil { - return nil - } - return o.TeamIds -} diff --git a/internal/sdk/models/shared/postv1postmortemsreportsreportidreasons.go b/internal/sdk/models/shared/postv1postmortemsreportsreportidreasons.go deleted file mode 100644 index 781f9a4..0000000 --- a/internal/sdk/models/shared/postv1postmortemsreportsreportidreasons.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1PostMortemsReportsReportIDReasons - Add a new contributing factor to an incident -type PostV1PostMortemsReportsReportIDReasons struct { - Summary string `json:"summary"` -} - -func (o *PostV1PostMortemsReportsReportIDReasons) GetSummary() string { - if o == nil { - return "" - } - return o.Summary -} diff --git a/internal/sdk/models/shared/postv1priorities.go b/internal/sdk/models/shared/postv1priorities.go deleted file mode 100644 index 295f2fd..0000000 --- a/internal/sdk/models/shared/postv1priorities.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1Priorities - Create a new priority -type PostV1Priorities struct { - Slug string `json:"slug"` - Description *string `json:"description,omitempty"` - Default *bool `json:"default,omitempty"` -} - -func (o *PostV1Priorities) GetSlug() string { - if o == nil { - return "" - } - return o.Slug -} - -func (o *PostV1Priorities) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1Priorities) GetDefault() *bool { - if o == nil { - return nil - } - return o.Default -} diff --git a/internal/sdk/models/shared/postv1runbooks.go b/internal/sdk/models/shared/postv1runbooks.go deleted file mode 100644 index 24f5cfd..0000000 --- a/internal/sdk/models/shared/postv1runbooks.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// PostV1RunbooksType - Deprecated, but still required. Please just use 'incident' -type PostV1RunbooksType string - -const ( - PostV1RunbooksTypeIncident PostV1RunbooksType = "incident" - PostV1RunbooksTypeGeneral PostV1RunbooksType = "general" - PostV1RunbooksTypeInfrastructure PostV1RunbooksType = "infrastructure" - PostV1RunbooksTypeIncidentRole PostV1RunbooksType = "incident_role" -) - -func (e PostV1RunbooksType) ToPointer() *PostV1RunbooksType { - return &e -} -func (e *PostV1RunbooksType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "incident": - fallthrough - case "general": - fallthrough - case "infrastructure": - fallthrough - case "incident_role": - *e = PostV1RunbooksType(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1RunbooksType: %v", v) - } -} - -// PostV1RunbooksOwner - An object representing a Team that owns the runbook -type PostV1RunbooksOwner struct { - ID string `json:"id"` -} - -func (o *PostV1RunbooksOwner) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type AttachmentRule struct { - // The JSON logic for the attaching the runbook - Logic string `json:"logic"` - // The user data for the rule - UserData *string `json:"user_data,omitempty"` -} - -func (o *AttachmentRule) GetLogic() string { - if o == nil { - return "" - } - return o.Logic -} - -func (o *AttachmentRule) GetUserData() *string { - if o == nil { - return nil - } - return o.UserData -} - -type Rule struct { - // The JSON logic for the rule - Logic string `json:"logic"` - // The user data for the rule - UserData *string `json:"user_data,omitempty"` -} - -func (o *Rule) GetLogic() string { - if o == nil { - return "" - } - return o.Logic -} - -func (o *Rule) GetUserData() *string { - if o == nil { - return nil - } - return o.UserData -} - -type PostV1RunbooksSteps struct { - // Name for step - Name string `json:"name"` - // ID of action to use for this step. - ActionID string `json:"action_id"` - Rule *Rule `json:"rule,omitempty"` -} - -func (o *PostV1RunbooksSteps) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1RunbooksSteps) GetActionID() string { - if o == nil { - return "" - } - return o.ActionID -} - -func (o *PostV1RunbooksSteps) GetRule() *Rule { - if o == nil { - return nil - } - return o.Rule -} - -// PostV1Runbooks - Create a new runbook for use with incidents. -type PostV1Runbooks struct { - Name string `json:"name"` - // Deprecated, but still required. Please just use 'incident' - Type PostV1RunbooksType `json:"type"` - // Deprecated. Use description - Summary *string `json:"summary,omitempty"` - // A longer description about the Runbook. Supports markdown format - Description *string `json:"description,omitempty"` - // Whether or not this runbook should be automatically attached to restricted incidents. Note that setting this to `true` will prevent it from being attached to public incidents, even manually. Defaults to `false`. - AutoAttachToRestrictedIncidents *bool `json:"auto_attach_to_restricted_incidents,omitempty"` - // Whether or not this runbook is a tutorial runbook - Tutorial *bool `json:"tutorial,omitempty"` - // An object representing a Team that owns the runbook - Owner *PostV1RunbooksOwner `json:"owner,omitempty"` - AttachmentRule *AttachmentRule `json:"attachment_rule,omitempty"` - Steps []PostV1RunbooksSteps `json:"steps,omitempty"` -} - -func (o *PostV1Runbooks) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1Runbooks) GetType() PostV1RunbooksType { - if o == nil { - return PostV1RunbooksType("") - } - return o.Type -} - -func (o *PostV1Runbooks) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PostV1Runbooks) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1Runbooks) GetAutoAttachToRestrictedIncidents() *bool { - if o == nil { - return nil - } - return o.AutoAttachToRestrictedIncidents -} - -func (o *PostV1Runbooks) GetTutorial() *bool { - if o == nil { - return nil - } - return o.Tutorial -} - -func (o *PostV1Runbooks) GetOwner() *PostV1RunbooksOwner { - if o == nil { - return nil - } - return o.Owner -} - -func (o *PostV1Runbooks) GetAttachmentRule() *AttachmentRule { - if o == nil { - return nil - } - return o.AttachmentRule -} - -func (o *PostV1Runbooks) GetSteps() []PostV1RunbooksSteps { - if o == nil { - return nil - } - return o.Steps -} diff --git a/internal/sdk/models/shared/postv1runbooksexecutions.go b/internal/sdk/models/shared/postv1runbooksexecutions.go deleted file mode 100644 index bc00cf5..0000000 --- a/internal/sdk/models/shared/postv1runbooksexecutions.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1RunbooksExecutions - Attaches a runbook to an incident and executes it -type PostV1RunbooksExecutions struct { - // The incident to attach the runbook to. Format must be: `incident/${incidentId}` - ExecuteFor string `json:"execute_for"` - // ID of runbook to attach - RunbookID string `json:"runbook_id"` -} - -func (o *PostV1RunbooksExecutions) GetExecuteFor() string { - if o == nil { - return "" - } - return o.ExecuteFor -} - -func (o *PostV1RunbooksExecutions) GetRunbookID() string { - if o == nil { - return "" - } - return o.RunbookID -} diff --git a/internal/sdk/models/shared/postv1savedsearchesresourcetype.go b/internal/sdk/models/shared/postv1savedsearchesresourcetype.go deleted file mode 100644 index a9c75f3..0000000 --- a/internal/sdk/models/shared/postv1savedsearchesresourcetype.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1SavedSearchesResourceType - Create a new saved search for a particular resource type -type PostV1SavedSearchesResourceType struct { - Name string `json:"name"` - IsPrivate *bool `json:"is_private,omitempty"` - FilterValues map[string]any `json:"filter_values"` -} - -func (o *PostV1SavedSearchesResourceType) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1SavedSearchesResourceType) GetIsPrivate() *bool { - if o == nil { - return nil - } - return o.IsPrivate -} - -func (o *PostV1SavedSearchesResourceType) GetFilterValues() map[string]any { - if o == nil { - return map[string]any{} - } - return o.FilterValues -} diff --git a/internal/sdk/models/shared/postv1scheduledmaintenances.go b/internal/sdk/models/shared/postv1scheduledmaintenances.go deleted file mode 100644 index 5eadec8..0000000 --- a/internal/sdk/models/shared/postv1scheduledmaintenances.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type PostV1ScheduledMaintenancesStatusPages struct { - // The slug identifying the type of status page - IntegrationSlug *string `json:"integration_slug,omitempty"` - // The UUID of the status page to display this maintenance on - ConnectionID string `json:"connection_id"` -} - -func (o *PostV1ScheduledMaintenancesStatusPages) GetIntegrationSlug() *string { - if o == nil { - return nil - } - return o.IntegrationSlug -} - -func (o *PostV1ScheduledMaintenancesStatusPages) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -type PostV1ScheduledMaintenancesImpacts struct { - // The type of impact - Type string `json:"type"` - // The id of impact - ID string `json:"id"` - // The id of the condition - ConditionID string `json:"condition_id"` -} - -func (o *PostV1ScheduledMaintenancesImpacts) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *PostV1ScheduledMaintenancesImpacts) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PostV1ScheduledMaintenancesImpacts) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -// PostV1ScheduledMaintenances - Create a new scheduled maintenance event -type PostV1ScheduledMaintenances struct { - Name string `json:"name"` - // ISO8601 timestamp for the start time of the scheduled maintenance - StartsAt time.Time `json:"starts_at"` - // ISO8601 timestamp for the end time of the scheduled maintenance - EndsAt time.Time `json:"ends_at"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - // A json object of label keys and values - Labels map[string]string `json:"labels,omitempty"` - // An array of status pages to display this maintenance on - StatusPages []PostV1ScheduledMaintenancesStatusPages `json:"status_pages,omitempty"` - // An array of impact/condition combinations - Impacts []PostV1ScheduledMaintenancesImpacts `json:"impacts,omitempty"` -} - -func (p PostV1ScheduledMaintenances) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PostV1ScheduledMaintenances) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PostV1ScheduledMaintenances) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1ScheduledMaintenances) GetStartsAt() time.Time { - if o == nil { - return time.Time{} - } - return o.StartsAt -} - -func (o *PostV1ScheduledMaintenances) GetEndsAt() time.Time { - if o == nil { - return time.Time{} - } - return o.EndsAt -} - -func (o *PostV1ScheduledMaintenances) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PostV1ScheduledMaintenances) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1ScheduledMaintenances) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PostV1ScheduledMaintenances) GetStatusPages() []PostV1ScheduledMaintenancesStatusPages { - if o == nil { - return nil - } - return o.StatusPages -} - -func (o *PostV1ScheduledMaintenances) GetImpacts() []PostV1ScheduledMaintenancesImpacts { - if o == nil { - return nil - } - return o.Impacts -} diff --git a/internal/sdk/models/shared/postv1scimv2groups.go b/internal/sdk/models/shared/postv1scimv2groups.go deleted file mode 100644 index fc8e20a..0000000 --- a/internal/sdk/models/shared/postv1scimv2groups.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PostV1ScimV2GroupsMembers struct { - // String that represents the user's UUID to assign to the team - Value string `json:"value"` -} - -func (o *PostV1ScimV2GroupsMembers) GetValue() string { - if o == nil { - return "" - } - return o.Value -} - -// PostV1ScimV2Groups - SCIM endpoint to create a new Team (Colloquial for Group in the SCIM protocol). Any members defined in the payload will be assigned to the team with no defined role. -type PostV1ScimV2Groups struct { - // The name of the team being created - DisplayName string `json:"displayName"` - Members []PostV1ScimV2GroupsMembers `json:"members"` -} - -func (o *PostV1ScimV2Groups) GetDisplayName() string { - if o == nil { - return "" - } - return o.DisplayName -} - -func (o *PostV1ScimV2Groups) GetMembers() []PostV1ScimV2GroupsMembers { - if o == nil { - return []PostV1ScimV2GroupsMembers{} - } - return o.Members -} diff --git a/internal/sdk/models/shared/postv1scimv2users.go b/internal/sdk/models/shared/postv1scimv2users.go deleted file mode 100644 index 0dcebb5..0000000 --- a/internal/sdk/models/shared/postv1scimv2users.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1ScimV2UsersName - The components of the user's name -type PostV1ScimV2UsersName struct { - // The family name of the User, or last name in most Western languages - FamilyName string `json:"familyName"` - // The given name of the User, or first name in most Western languages - GivenName string `json:"givenName"` -} - -func (o *PostV1ScimV2UsersName) GetFamilyName() string { - if o == nil { - return "" - } - return o.FamilyName -} - -func (o *PostV1ScimV2UsersName) GetGivenName() string { - if o == nil { - return "" - } - return o.GivenName -} - -type PostV1ScimV2UsersEmails struct { - // String that represents an email address for the User - Value string `json:"value"` - // Boolean which signifies if an email is intended as the primary email for the User - Primary bool `json:"primary"` -} - -func (o *PostV1ScimV2UsersEmails) GetValue() string { - if o == nil { - return "" - } - return o.Value -} - -func (o *PostV1ScimV2UsersEmails) GetPrimary() bool { - if o == nil { - return false - } - return o.Primary -} - -// PostV1ScimV2Users - SCIM endpoint to create and provision a new User. This endpoint will provision the User, which allows them to accept their account throught their IDP or via the Forgot Password flow. -type PostV1ScimV2Users struct { - // A service provider's unique identifier for the user - UserName string `json:"userName"` - // The components of the user's name - Name PostV1ScimV2UsersName `json:"name"` - // Email addresses for the User - Emails []PostV1ScimV2UsersEmails `json:"emails"` - // Roles for the User. Options are owner, member or collaborator - Roles []string `json:"roles,omitempty"` - // This attribute is intended to be used as a means to set, replace, or compare (i.e., filter for equality) a password - Password *string `json:"password,omitempty"` -} - -func (o *PostV1ScimV2Users) GetUserName() string { - if o == nil { - return "" - } - return o.UserName -} - -func (o *PostV1ScimV2Users) GetName() PostV1ScimV2UsersName { - if o == nil { - return PostV1ScimV2UsersName{} - } - return o.Name -} - -func (o *PostV1ScimV2Users) GetEmails() []PostV1ScimV2UsersEmails { - if o == nil { - return []PostV1ScimV2UsersEmails{} - } - return o.Emails -} - -func (o *PostV1ScimV2Users) GetRoles() []string { - if o == nil { - return nil - } - return o.Roles -} - -func (o *PostV1ScimV2Users) GetPassword() *string { - if o == nil { - return nil - } - return o.Password -} diff --git a/internal/sdk/models/shared/postv1servicedependencies.go b/internal/sdk/models/shared/postv1servicedependencies.go deleted file mode 100644 index 24cf97d..0000000 --- a/internal/sdk/models/shared/postv1servicedependencies.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1ServiceDependencies - Creates a service dependency relationship between two services -type PostV1ServiceDependencies struct { - ServiceID string `json:"service_id"` - ConnectedServiceID string `json:"connected_service_id"` - // A note to describe the service dependency relationship - Notes *string `json:"notes,omitempty"` -} - -func (o *PostV1ServiceDependencies) GetServiceID() string { - if o == nil { - return "" - } - return o.ServiceID -} - -func (o *PostV1ServiceDependencies) GetConnectedServiceID() string { - if o == nil { - return "" - } - return o.ConnectedServiceID -} - -func (o *PostV1ServiceDependencies) GetNotes() *string { - if o == nil { - return nil - } - return o.Notes -} diff --git a/internal/sdk/models/shared/postv1services.go b/internal/sdk/models/shared/postv1services.go deleted file mode 100644 index b51ff6b..0000000 --- a/internal/sdk/models/shared/postv1services.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// ServiceTier - Integer representing service tier. Lower values represent higher criticality. If not specified the default value will be 5. -type ServiceTier int - -const ( - ServiceTierZero ServiceTier = 0 - ServiceTierOne ServiceTier = 1 - ServiceTierTwo ServiceTier = 2 - ServiceTierThree ServiceTier = 3 - ServiceTierFour ServiceTier = 4 - ServiceTierFive ServiceTier = 5 -) - -func (e ServiceTier) ToPointer() *ServiceTier { - return &e -} -func (e *ServiceTier) UnmarshalJSON(data []byte) error { - var v int - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case 0: - fallthrough - case 1: - fallthrough - case 2: - fallthrough - case 3: - fallthrough - case 4: - fallthrough - case 5: - *e = ServiceTier(v) - return nil - default: - return fmt.Errorf("invalid value for ServiceTier: %v", v) - } -} - -type Functionalities struct { - // If you are trying to create a new functionality and attach it to this service, set the summary key - Summary *string `json:"summary,omitempty"` - // If you are trying to reuse a functionality, you may set the ID to attach it to the service - ID *string `json:"id,omitempty"` -} - -func (o *Functionalities) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *Functionalities) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -type Links struct { - // Short name used to display and identify this link - Name string `json:"name"` - // URL - HrefURL string `json:"href_url"` - // An optional URL to an icon representing this link - IconURL *string `json:"icon_url,omitempty"` -} - -func (o *Links) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *Links) GetHrefURL() string { - if o == nil { - return "" - } - return o.HrefURL -} - -func (o *Links) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -// Owner - An object representing a Team that owns the service -type Owner struct { - ID string `json:"id"` -} - -func (o *Owner) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type Teams struct { - ID string `json:"id"` -} - -func (o *Teams) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type ExternalResources struct { - RemoteID string `json:"remote_id"` - // The integration slug for the external resource. Can be one of: github, opsgenie, pager_duty, victorops. Not required if the resource has already been imported. - ConnectionType *string `json:"connection_type,omitempty"` -} - -func (o *ExternalResources) GetRemoteID() string { - if o == nil { - return "" - } - return o.RemoteID -} - -func (o *ExternalResources) GetConnectionType() *string { - if o == nil { - return nil - } - return o.ConnectionType -} - -// PostV1Services - Creates a service for the organization, you may also create or attach functionalities to the service on create. -type PostV1Services struct { - Name string `json:"name"` - Description *string `json:"description,omitempty"` - // A hash of label keys and values - Labels map[string]string `json:"labels,omitempty"` - // Integer representing service tier. Lower values represent higher criticality. If not specified the default value will be 5. - ServiceTier *ServiceTier `json:"service_tier,omitempty"` - // An array of functionalities - Functionalities []Functionalities `json:"functionalities,omitempty"` - // An array of links to associate with this service - Links []Links `json:"links,omitempty"` - // An object representing a Team that owns the service - Owner *Owner `json:"owner,omitempty"` - // An array of teams to attach to this service. - Teams []Teams `json:"teams,omitempty"` - AlertOnAdd *bool `json:"alert_on_add,omitempty"` - AutoAddRespondingTeam *bool `json:"auto_add_responding_team,omitempty"` - // An array of external resources to attach to this service. - ExternalResources []ExternalResources `json:"external_resources,omitempty"` -} - -func (o *PostV1Services) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1Services) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1Services) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *PostV1Services) GetServiceTier() *ServiceTier { - if o == nil { - return nil - } - return o.ServiceTier -} - -func (o *PostV1Services) GetFunctionalities() []Functionalities { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *PostV1Services) GetLinks() []Links { - if o == nil { - return nil - } - return o.Links -} - -func (o *PostV1Services) GetOwner() *Owner { - if o == nil { - return nil - } - return o.Owner -} - -func (o *PostV1Services) GetTeams() []Teams { - if o == nil { - return nil - } - return o.Teams -} - -func (o *PostV1Services) GetAlertOnAdd() *bool { - if o == nil { - return nil - } - return o.AlertOnAdd -} - -func (o *PostV1Services) GetAutoAddRespondingTeam() *bool { - if o == nil { - return nil - } - return o.AutoAddRespondingTeam -} - -func (o *PostV1Services) GetExternalResources() []ExternalResources { - if o == nil { - return nil - } - return o.ExternalResources -} diff --git a/internal/sdk/models/shared/postv1servicesserviceidchecklistresponsechecklistid.go b/internal/sdk/models/shared/postv1servicesserviceidchecklistresponsechecklistid.go deleted file mode 100644 index 0800944..0000000 --- a/internal/sdk/models/shared/postv1servicesserviceidchecklistresponsechecklistid.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1ServicesServiceIDChecklistResponseChecklistID - Creates a response for a checklist item -type PostV1ServicesServiceIDChecklistResponseChecklistID struct { - CheckID string `json:"check_id"` - // Status of the check. 'true' if it's complete, 'false' if incomplete, or blank if not yet interacted with - Status bool `json:"status"` -} - -func (o *PostV1ServicesServiceIDChecklistResponseChecklistID) GetCheckID() string { - if o == nil { - return "" - } - return o.CheckID -} - -func (o *PostV1ServicesServiceIDChecklistResponseChecklistID) GetStatus() bool { - if o == nil { - return false - } - return o.Status -} diff --git a/internal/sdk/models/shared/postv1servicesservicelinks.go b/internal/sdk/models/shared/postv1servicesservicelinks.go deleted file mode 100644 index 01e0796..0000000 --- a/internal/sdk/models/shared/postv1servicesservicelinks.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// Integration - The name of the service -type Integration string - -const ( - IntegrationPagerDuty Integration = "pager_duty" - IntegrationOpsgenie Integration = "opsgenie" - IntegrationVictorops Integration = "victorops" -) - -func (e Integration) ToPointer() *Integration { - return &e -} -func (e *Integration) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "pager_duty": - fallthrough - case "opsgenie": - fallthrough - case "victorops": - *e = Integration(v) - return nil - default: - return fmt.Errorf("invalid value for Integration: %v", v) - } -} - -// PostV1ServicesServiceLinks - Creates a service with the appropriate integration for each external service ID passed -type PostV1ServicesServiceLinks struct { - // ID of the service - ExternalServiceIds string `json:"external_service_ids"` - // ID for the integration. This can be found by going to the edit page for the integration - ConnectionID string `json:"connection_id"` - // The name of the service - Integration Integration `json:"integration"` -} - -func (o *PostV1ServicesServiceLinks) GetExternalServiceIds() string { - if o == nil { - return "" - } - return o.ExternalServiceIds -} - -func (o *PostV1ServicesServiceLinks) GetConnectionID() string { - if o == nil { - return "" - } - return o.ConnectionID -} - -func (o *PostV1ServicesServiceLinks) GetIntegration() Integration { - if o == nil { - return Integration("") - } - return o.Integration -} diff --git a/internal/sdk/models/shared/postv1severities.go b/internal/sdk/models/shared/postv1severities.go deleted file mode 100644 index f3f6be3..0000000 --- a/internal/sdk/models/shared/postv1severities.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type Color string - -const ( - ColorRed Color = "red" - ColorOrange Color = "orange" - ColorYellow Color = "yellow" - ColorBlue Color = "blue" - ColorTeal Color = "teal" - ColorGrey Color = "grey" -) - -func (e Color) ToPointer() *Color { - return &e -} -func (e *Color) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "red": - fallthrough - case "orange": - fallthrough - case "yellow": - fallthrough - case "blue": - fallthrough - case "teal": - fallthrough - case "grey": - *e = Color(v) - return nil - default: - return fmt.Errorf("invalid value for Color: %v", v) - } -} - -// PostV1Severities - Create a new severity -type PostV1Severities struct { - Slug string `json:"slug"` - Description *string `json:"description,omitempty"` - Position *int `json:"position,omitempty"` - Color *Color `json:"color,omitempty"` -} - -func (o *PostV1Severities) GetSlug() string { - if o == nil { - return "" - } - return o.Slug -} - -func (o *PostV1Severities) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1Severities) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *PostV1Severities) GetColor() *Color { - if o == nil { - return nil - } - return o.Color -} diff --git a/internal/sdk/models/shared/postv1severitymatrixconditions.go b/internal/sdk/models/shared/postv1severitymatrixconditions.go deleted file mode 100644 index 99fbf12..0000000 --- a/internal/sdk/models/shared/postv1severitymatrixconditions.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1SeverityMatrixConditions - Create a new condition -type PostV1SeverityMatrixConditions struct { - Name string `json:"name"` - // Position is used to determine ordering of conditions in API responses and dropdowns. The condition with the lowest position (typically 0) will be considered the Default Condition - Position *int `json:"position,omitempty"` -} - -func (o *PostV1SeverityMatrixConditions) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1SeverityMatrixConditions) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/postv1severitymatriximpacts.go b/internal/sdk/models/shared/postv1severitymatriximpacts.go deleted file mode 100644 index 232f974..0000000 --- a/internal/sdk/models/shared/postv1severitymatriximpacts.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1SeverityMatrixImpacts - Create a new impact -type PostV1SeverityMatrixImpacts struct { - AffectsType string `json:"affects_type"` - AffectsID string `json:"affects_id"` - Position *int `json:"position,omitempty"` -} - -func (o *PostV1SeverityMatrixImpacts) GetAffectsType() string { - if o == nil { - return "" - } - return o.AffectsType -} - -func (o *PostV1SeverityMatrixImpacts) GetAffectsID() string { - if o == nil { - return "" - } - return o.AffectsID -} - -func (o *PostV1SeverityMatrixImpacts) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/postv1signalsdebugger.go b/internal/sdk/models/shared/postv1signalsdebugger.go deleted file mode 100644 index 6f0c929..0000000 --- a/internal/sdk/models/shared/postv1signalsdebugger.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type Images struct { - Src *string `json:"src,omitempty"` - Alt *string `json:"alt,omitempty"` -} - -func (o *Images) GetSrc() *string { - if o == nil { - return nil - } - return o.Src -} - -func (o *Images) GetAlt() *string { - if o == nil { - return nil - } - return o.Alt -} - -type PostV1SignalsDebuggerLinks struct { - Href *string `json:"href,omitempty"` - Text *string `json:"text,omitempty"` -} - -func (o *PostV1SignalsDebuggerLinks) GetHref() *string { - if o == nil { - return nil - } - return o.Href -} - -func (o *PostV1SignalsDebuggerLinks) GetText() *string { - if o == nil { - return nil - } - return o.Text -} - -type Signals struct { - Summary *string `json:"summary,omitempty"` - Body *string `json:"body,omitempty"` - Level *string `json:"level,omitempty"` - Images []Images `json:"images,omitempty"` - Links []PostV1SignalsDebuggerLinks `json:"links,omitempty"` -} - -func (o *Signals) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *Signals) GetBody() *string { - if o == nil { - return nil - } - return o.Body -} - -func (o *Signals) GetLevel() *string { - if o == nil { - return nil - } - return o.Level -} - -func (o *Signals) GetImages() []Images { - if o == nil { - return nil - } - return o.Images -} - -func (o *Signals) GetLinks() []PostV1SignalsDebuggerLinks { - if o == nil { - return nil - } - return o.Links -} - -type PostV1SignalsDebugger struct { - // CEL expression - Expression string `json:"expression"` - // List of signals to evaluate rule expression against - Signals []Signals `json:"signals"` -} - -func (o *PostV1SignalsDebugger) GetExpression() string { - if o == nil { - return "" - } - return o.Expression -} - -func (o *PostV1SignalsDebugger) GetSignals() []Signals { - if o == nil { - return []Signals{} - } - return o.Signals -} diff --git a/internal/sdk/models/shared/postv1signalsemailtargets.go b/internal/sdk/models/shared/postv1signalsemailtargets.go deleted file mode 100644 index 68d6b6f..0000000 --- a/internal/sdk/models/shared/postv1signalsemailtargets.go +++ /dev/null @@ -1,191 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// PostV1SignalsEmailTargetsType - The type of target that the inbound email will notify when matched. -type PostV1SignalsEmailTargetsType string - -const ( - PostV1SignalsEmailTargetsTypeTeam PostV1SignalsEmailTargetsType = "Team" - PostV1SignalsEmailTargetsTypeEntireTeam PostV1SignalsEmailTargetsType = "EntireTeam" - PostV1SignalsEmailTargetsTypeEscalationPolicy PostV1SignalsEmailTargetsType = "EscalationPolicy" - PostV1SignalsEmailTargetsTypeOnCallSchedule PostV1SignalsEmailTargetsType = "OnCallSchedule" - PostV1SignalsEmailTargetsTypeUser PostV1SignalsEmailTargetsType = "User" - PostV1SignalsEmailTargetsTypeSlackChannel PostV1SignalsEmailTargetsType = "SlackChannel" - PostV1SignalsEmailTargetsTypeWebhook PostV1SignalsEmailTargetsType = "Webhook" -) - -func (e PostV1SignalsEmailTargetsType) ToPointer() *PostV1SignalsEmailTargetsType { - return &e -} -func (e *PostV1SignalsEmailTargetsType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "Team": - fallthrough - case "EntireTeam": - fallthrough - case "EscalationPolicy": - fallthrough - case "OnCallSchedule": - fallthrough - case "User": - fallthrough - case "SlackChannel": - fallthrough - case "Webhook": - *e = PostV1SignalsEmailTargetsType(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1SignalsEmailTargetsType: %v", v) - } -} - -// Target - The target that the email target will notify. This object must contain a `type` -// field that specifies the type of target and an `id` field that specifies the ID of -// the target. The `type` field must be one of "escalation_policy", "on_call_schedule", -// "team", "user", or "slack_channel". -type Target struct { - // The type of target that the inbound email will notify when matched. - Type PostV1SignalsEmailTargetsType `json:"type"` - // The ID of the target that the inbound email will notify when matched. - ID string `json:"id"` -} - -func (o *Target) GetType() PostV1SignalsEmailTargetsType { - if o == nil { - return PostV1SignalsEmailTargetsType("") - } - return o.Type -} - -func (o *Target) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -// RuleMatchingStrategy - Whether or not all rules must match, or if only one rule must match. -type RuleMatchingStrategy string - -const ( - RuleMatchingStrategyAll RuleMatchingStrategy = "all" - RuleMatchingStrategyAny RuleMatchingStrategy = "any" -) - -func (e RuleMatchingStrategy) ToPointer() *RuleMatchingStrategy { - return &e -} -func (e *RuleMatchingStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "all": - fallthrough - case "any": - *e = RuleMatchingStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for RuleMatchingStrategy: %v", v) - } -} - -// PostV1SignalsEmailTargets - Create a Signals email target for a team. -type PostV1SignalsEmailTargets struct { - // The email target's name. - Name string `json:"name"` - // The email address that will be listening to events. - Slug *string `json:"slug,omitempty"` - // A detailed description of the email target. - Description *string `json:"description,omitempty"` - // The target that the email target will notify. This object must contain a `type` - // field that specifies the type of target and an `id` field that specifies the ID of - // the target. The `type` field must be one of "escalation_policy", "on_call_schedule", - // "team", "user", or "slack_channel". - // - Target *Target `json:"target,omitempty"` - // A list of email addresses that are allowed to send events to the target. Must be exact match. - AllowedSenders []string `json:"allowed_senders,omitempty"` - // A list of CEL expressions that should be evaluated and matched to determine if the target should be notified. - Rules []string `json:"rules,omitempty"` - // Whether or not all rules must match, or if only one rule must match. - RuleMatchingStrategy *RuleMatchingStrategy `json:"rule_matching_strategy,omitempty"` - // The CEL expression that defines the status of an incoming email that is sent to the target. - StatusCel *string `json:"status_cel,omitempty"` - // The CEL expression that defines the level of an incoming email that is sent to the target. - LevelCel *string `json:"level_cel,omitempty"` -} - -func (o *PostV1SignalsEmailTargets) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1SignalsEmailTargets) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PostV1SignalsEmailTargets) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1SignalsEmailTargets) GetTarget() *Target { - if o == nil { - return nil - } - return o.Target -} - -func (o *PostV1SignalsEmailTargets) GetAllowedSenders() []string { - if o == nil { - return nil - } - return o.AllowedSenders -} - -func (o *PostV1SignalsEmailTargets) GetRules() []string { - if o == nil { - return nil - } - return o.Rules -} - -func (o *PostV1SignalsEmailTargets) GetRuleMatchingStrategy() *RuleMatchingStrategy { - if o == nil { - return nil - } - return o.RuleMatchingStrategy -} - -func (o *PostV1SignalsEmailTargets) GetStatusCel() *string { - if o == nil { - return nil - } - return o.StatusCel -} - -func (o *PostV1SignalsEmailTargets) GetLevelCel() *string { - if o == nil { - return nil - } - return o.LevelCel -} diff --git a/internal/sdk/models/shared/postv1signalswebhooktargets.go b/internal/sdk/models/shared/postv1signalswebhooktargets.go deleted file mode 100644 index c44fad9..0000000 --- a/internal/sdk/models/shared/postv1signalswebhooktargets.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1SignalsWebhookTargets - Create a Signals webhook target. -type PostV1SignalsWebhookTargets struct { - // The webhook target's name. - Name string `json:"name"` - // An optional detailed description of the webhook target. - Description *string `json:"description,omitempty"` - // The URL that the webhook target will notify. - URL string `json:"url"` - // An optional secret we will provide in the `FH-Signature` header - // when sending a payload to the webhook target. This key will not be - // shown in any response once configured. - // - SigningKey *string `json:"signing_key,omitempty"` -} - -func (o *PostV1SignalsWebhookTargets) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1SignalsWebhookTargets) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1SignalsWebhookTargets) GetURL() string { - if o == nil { - return "" - } - return o.URL -} - -func (o *PostV1SignalsWebhookTargets) GetSigningKey() *string { - if o == nil { - return nil - } - return o.SigningKey -} diff --git a/internal/sdk/models/shared/postv1statusupdatetemplates.go b/internal/sdk/models/shared/postv1statusupdatetemplates.go deleted file mode 100644 index 2d5dc41..0000000 --- a/internal/sdk/models/shared/postv1statusupdatetemplates.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1StatusUpdateTemplates - Create a status update template for your organization -type PostV1StatusUpdateTemplates struct { - Name string `json:"name"` - Body string `json:"body"` -} - -func (o *PostV1StatusUpdateTemplates) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1StatusUpdateTemplates) GetBody() string { - if o == nil { - return "" - } - return o.Body -} diff --git a/internal/sdk/models/shared/postv1tasklists.go b/internal/sdk/models/shared/postv1tasklists.go deleted file mode 100644 index d67409e..0000000 --- a/internal/sdk/models/shared/postv1tasklists.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type TaskListItems struct { - // A summary of the task - Summary string `json:"summary"` - // A long-form description for the task if additional context is helpful - Description *string `json:"description,omitempty"` -} - -func (o *TaskListItems) GetSummary() string { - if o == nil { - return "" - } - return o.Summary -} - -func (o *TaskListItems) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -// PostV1TaskLists - Creates a new task list -type PostV1TaskLists struct { - Name string `json:"name"` - Description *string `json:"description,omitempty"` - TaskListItems []TaskListItems `json:"task_list_items"` -} - -func (o *PostV1TaskLists) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1TaskLists) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1TaskLists) GetTaskListItems() []TaskListItems { - if o == nil { - return []TaskListItems{} - } - return o.TaskListItems -} diff --git a/internal/sdk/models/shared/postv1teams.go b/internal/sdk/models/shared/postv1teams.go deleted file mode 100644 index b23c22e..0000000 --- a/internal/sdk/models/shared/postv1teams.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// MsTeamsChannel - MS Teams channel identity for channel associated with this team -type MsTeamsChannel struct { - ChannelID string `json:"channel_id"` - MsTeamID string `json:"ms_team_id"` -} - -func (o *MsTeamsChannel) GetChannelID() string { - if o == nil { - return "" - } - return o.ChannelID -} - -func (o *MsTeamsChannel) GetMsTeamID() string { - if o == nil { - return "" - } - return o.MsTeamID -} - -type Memberships struct { - UserID *string `json:"user_id,omitempty"` - ScheduleID *string `json:"schedule_id,omitempty"` - // An incident role ID that this user will automatically assigned if this team is assigned to an incident - IncidentRoleID *string `json:"incident_role_id,omitempty"` -} - -func (o *Memberships) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -func (o *Memberships) GetScheduleID() *string { - if o == nil { - return nil - } - return o.ScheduleID -} - -func (o *Memberships) GetIncidentRoleID() *string { - if o == nil { - return nil - } - return o.IncidentRoleID -} - -// PostV1Teams - Create a new team -type PostV1Teams struct { - Name string `json:"name"` - Description *string `json:"description,omitempty"` - Slug *string `json:"slug,omitempty"` - // The Slack channel ID that this team is associated with - SlackChannelID *string `json:"slack_channel_id,omitempty"` - // MS Teams channel identity for channel associated with this team - MsTeamsChannel *MsTeamsChannel `json:"ms_teams_channel,omitempty"` - Memberships []Memberships `json:"memberships,omitempty"` -} - -func (o *PostV1Teams) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1Teams) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1Teams) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PostV1Teams) GetSlackChannelID() *string { - if o == nil { - return nil - } - return o.SlackChannelID -} - -func (o *PostV1Teams) GetMsTeamsChannel() *MsTeamsChannel { - if o == nil { - return nil - } - return o.MsTeamsChannel -} - -func (o *PostV1Teams) GetMemberships() []Memberships { - if o == nil { - return nil - } - return o.Memberships -} diff --git a/internal/sdk/models/shared/postv1teamsteamidescalationpolicies.go b/internal/sdk/models/shared/postv1teamsteamidescalationpolicies.go deleted file mode 100644 index 22cbb05..0000000 --- a/internal/sdk/models/shared/postv1teamsteamidescalationpolicies.go +++ /dev/null @@ -1,205 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" -) - -// PostV1TeamsTeamIDEscalationPoliciesType - The type of target that the step will notify. -type PostV1TeamsTeamIDEscalationPoliciesType string - -const ( - PostV1TeamsTeamIDEscalationPoliciesTypeOnCallSchedule PostV1TeamsTeamIDEscalationPoliciesType = "OnCallSchedule" - PostV1TeamsTeamIDEscalationPoliciesTypeUser PostV1TeamsTeamIDEscalationPoliciesType = "User" - PostV1TeamsTeamIDEscalationPoliciesTypeSlackChannel PostV1TeamsTeamIDEscalationPoliciesType = "SlackChannel" - PostV1TeamsTeamIDEscalationPoliciesTypeEntireTeam PostV1TeamsTeamIDEscalationPoliciesType = "EntireTeam" - PostV1TeamsTeamIDEscalationPoliciesTypeWebhook PostV1TeamsTeamIDEscalationPoliciesType = "Webhook" -) - -func (e PostV1TeamsTeamIDEscalationPoliciesType) ToPointer() *PostV1TeamsTeamIDEscalationPoliciesType { - return &e -} -func (e *PostV1TeamsTeamIDEscalationPoliciesType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "OnCallSchedule": - fallthrough - case "User": - fallthrough - case "SlackChannel": - fallthrough - case "EntireTeam": - fallthrough - case "Webhook": - *e = PostV1TeamsTeamIDEscalationPoliciesType(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1TeamsTeamIDEscalationPoliciesType: %v", v) - } -} - -type Targets struct { - // The type of target that the step will notify. - Type PostV1TeamsTeamIDEscalationPoliciesType `json:"type"` - // The ID of the target that the step will notify. - ID string `json:"id"` -} - -func (o *Targets) GetType() PostV1TeamsTeamIDEscalationPoliciesType { - if o == nil { - return PostV1TeamsTeamIDEscalationPoliciesType("") - } - return o.Type -} - -func (o *Targets) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -type Steps struct { - // A list of targets that the step will notify. You can specify up to 15 targets per step. - Targets []Targets `json:"targets"` - // An ISO8601 duration string specifying how long to wait before moving on to the next step. For the last step, this value specifies how long to wait before the escalation policy should repeat, if it repeats. - Timeout string `json:"timeout"` -} - -func (o *Steps) GetTargets() []Targets { - if o == nil { - return []Targets{} - } - return o.Targets -} - -func (o *Steps) GetTimeout() string { - if o == nil { - return "" - } - return o.Timeout -} - -// PostV1TeamsTeamIDEscalationPoliciesTargetType - The type of target to which the policy will hand off. -type PostV1TeamsTeamIDEscalationPoliciesTargetType string - -const ( - PostV1TeamsTeamIDEscalationPoliciesTargetTypeEscalationPolicy PostV1TeamsTeamIDEscalationPoliciesTargetType = "EscalationPolicy" - PostV1TeamsTeamIDEscalationPoliciesTargetTypeTeam PostV1TeamsTeamIDEscalationPoliciesTargetType = "Team" -) - -func (e PostV1TeamsTeamIDEscalationPoliciesTargetType) ToPointer() *PostV1TeamsTeamIDEscalationPoliciesTargetType { - return &e -} -func (e *PostV1TeamsTeamIDEscalationPoliciesTargetType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "EscalationPolicy": - fallthrough - case "Team": - *e = PostV1TeamsTeamIDEscalationPoliciesTargetType(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1TeamsTeamIDEscalationPoliciesTargetType: %v", v) - } -} - -// HandoffStep - A step that defines where an alert should be sent when the policy is exhausted and the alert is still unacknowledged. -type HandoffStep struct { - // The type of target to which the policy will hand off. - TargetType PostV1TeamsTeamIDEscalationPoliciesTargetType `json:"target_type"` - // The ID of the target to which the policy will hand off. - TargetID string `json:"target_id"` -} - -func (o *HandoffStep) GetTargetType() PostV1TeamsTeamIDEscalationPoliciesTargetType { - if o == nil { - return PostV1TeamsTeamIDEscalationPoliciesTargetType("") - } - return o.TargetType -} - -func (o *HandoffStep) GetTargetID() string { - if o == nil { - return "" - } - return o.TargetID -} - -// PostV1TeamsTeamIDEscalationPolicies - Create a Signals escalation policy for a team. -type PostV1TeamsTeamIDEscalationPolicies struct { - // The escalation policy's name. - Name string `json:"name"` - // A detailed description of the escalation policy. - Description *string `json:"description,omitempty"` - // The number of times that the escalation policy should repeat before an alert is dropped. - Repetitions *int `default:"0" json:"repetitions"` - // Whether this escalation policy should be the default for the team. - Default *bool `default:"false" json:"default"` - // A list of steps that define how an alert should escalate through the policy. - Steps []Steps `json:"steps"` - // A step that defines where an alert should be sent when the policy is exhausted and the alert is still unacknowledged. - HandoffStep *HandoffStep `json:"handoff_step,omitempty"` -} - -func (p PostV1TeamsTeamIDEscalationPolicies) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PostV1TeamsTeamIDEscalationPolicies) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PostV1TeamsTeamIDEscalationPolicies) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1TeamsTeamIDEscalationPolicies) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1TeamsTeamIDEscalationPolicies) GetRepetitions() *int { - if o == nil { - return nil - } - return o.Repetitions -} - -func (o *PostV1TeamsTeamIDEscalationPolicies) GetDefault() *bool { - if o == nil { - return nil - } - return o.Default -} - -func (o *PostV1TeamsTeamIDEscalationPolicies) GetSteps() []Steps { - if o == nil { - return []Steps{} - } - return o.Steps -} - -func (o *PostV1TeamsTeamIDEscalationPolicies) GetHandoffStep() *HandoffStep { - if o == nil { - return nil - } - return o.HandoffStep -} diff --git a/internal/sdk/models/shared/postv1teamsteamidoncallschedules.go b/internal/sdk/models/shared/postv1teamsteamidoncallschedules.go deleted file mode 100644 index 4aab69c..0000000 --- a/internal/sdk/models/shared/postv1teamsteamidoncallschedules.go +++ /dev/null @@ -1,352 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type Members struct { - // The ID of a user who should be added to the schedule's rotation. You can add a user to the schedule - // multiple times to construct more complex rotations, and you can specify a `null` user ID to create - // unassigned slots in the rotation. - // - UserID *string `json:"user_id,omitempty"` -} - -func (o *Members) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -// PostV1TeamsTeamIDOnCallSchedulesType - The type of strategy. Must be one of "daily", "weekly", or "custom". -type PostV1TeamsTeamIDOnCallSchedulesType string - -const ( - PostV1TeamsTeamIDOnCallSchedulesTypeDaily PostV1TeamsTeamIDOnCallSchedulesType = "daily" - PostV1TeamsTeamIDOnCallSchedulesTypeWeekly PostV1TeamsTeamIDOnCallSchedulesType = "weekly" - PostV1TeamsTeamIDOnCallSchedulesTypeCustom PostV1TeamsTeamIDOnCallSchedulesType = "custom" -) - -func (e PostV1TeamsTeamIDOnCallSchedulesType) ToPointer() *PostV1TeamsTeamIDOnCallSchedulesType { - return &e -} -func (e *PostV1TeamsTeamIDOnCallSchedulesType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "daily": - fallthrough - case "weekly": - fallthrough - case "custom": - *e = PostV1TeamsTeamIDOnCallSchedulesType(v) - return nil - default: - return fmt.Errorf("invalid value for PostV1TeamsTeamIDOnCallSchedulesType: %v", v) - } -} - -// HandoffDay - The day of the week on which on-call shifts should hand off, as its long-form name (e.g. "monday", "tuesday", etc). This value is only used if the strategy type is "weekly". -type HandoffDay string - -const ( - HandoffDayMonday HandoffDay = "monday" - HandoffDayTuesday HandoffDay = "tuesday" - HandoffDayWednesday HandoffDay = "wednesday" - HandoffDayThursday HandoffDay = "thursday" - HandoffDayFriday HandoffDay = "friday" - HandoffDaySaturday HandoffDay = "saturday" - HandoffDaySunday HandoffDay = "sunday" -) - -func (e HandoffDay) ToPointer() *HandoffDay { - return &e -} -func (e *HandoffDay) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "monday": - fallthrough - case "tuesday": - fallthrough - case "wednesday": - fallthrough - case "thursday": - fallthrough - case "friday": - fallthrough - case "saturday": - fallthrough - case "sunday": - *e = HandoffDay(v) - return nil - default: - return fmt.Errorf("invalid value for HandoffDay: %v", v) - } -} - -// Strategy - An object that specifies how the schedule's on-call shifts should be generated. -type Strategy struct { - // The type of strategy. Must be one of "daily", "weekly", or "custom". - Type PostV1TeamsTeamIDOnCallSchedulesType `json:"type"` - // An ISO8601 time string specifying when on-call shifts should hand off. This value is only used if the strategy type is "daily" or "weekly". - HandoffTime *string `json:"handoff_time,omitempty"` - // The day of the week on which on-call shifts should hand off, as its long-form name (e.g. "monday", "tuesday", etc). This value is only used if the strategy type is "weekly". - HandoffDay *HandoffDay `json:"handoff_day,omitempty"` - // An ISO8601 duration string specifying how long each shift should last. This value is only used if the strategy type is "custom". - ShiftDuration *string `json:"shift_duration,omitempty"` -} - -func (o *Strategy) GetType() PostV1TeamsTeamIDOnCallSchedulesType { - if o == nil { - return PostV1TeamsTeamIDOnCallSchedulesType("") - } - return o.Type -} - -func (o *Strategy) GetHandoffTime() *string { - if o == nil { - return nil - } - return o.HandoffTime -} - -func (o *Strategy) GetHandoffDay() *HandoffDay { - if o == nil { - return nil - } - return o.HandoffDay -} - -func (o *Strategy) GetShiftDuration() *string { - if o == nil { - return nil - } - return o.ShiftDuration -} - -// StartDay - The day of the week on which the restriction should start, as its long-form name (e.g. "monday", "tuesday", etc). -type StartDay string - -const ( - StartDayMonday StartDay = "monday" - StartDayTuesday StartDay = "tuesday" - StartDayWednesday StartDay = "wednesday" - StartDayThursday StartDay = "thursday" - StartDayFriday StartDay = "friday" - StartDaySaturday StartDay = "saturday" - StartDaySunday StartDay = "sunday" -) - -func (e StartDay) ToPointer() *StartDay { - return &e -} -func (e *StartDay) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "monday": - fallthrough - case "tuesday": - fallthrough - case "wednesday": - fallthrough - case "thursday": - fallthrough - case "friday": - fallthrough - case "saturday": - fallthrough - case "sunday": - *e = StartDay(v) - return nil - default: - return fmt.Errorf("invalid value for StartDay: %v", v) - } -} - -// EndDay - The day of the week on which the restriction should end, as its long-form name (e.g. "monday", "tuesday", etc). -type EndDay string - -const ( - EndDayMonday EndDay = "monday" - EndDayTuesday EndDay = "tuesday" - EndDayWednesday EndDay = "wednesday" - EndDayThursday EndDay = "thursday" - EndDayFriday EndDay = "friday" - EndDaySaturday EndDay = "saturday" - EndDaySunday EndDay = "sunday" -) - -func (e EndDay) ToPointer() *EndDay { - return &e -} -func (e *EndDay) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "monday": - fallthrough - case "tuesday": - fallthrough - case "wednesday": - fallthrough - case "thursday": - fallthrough - case "friday": - fallthrough - case "saturday": - fallthrough - case "sunday": - *e = EndDay(v) - return nil - default: - return fmt.Errorf("invalid value for EndDay: %v", v) - } -} - -type Restrictions struct { - // The day of the week on which the restriction should start, as its long-form name (e.g. "monday", "tuesday", etc). - StartDay StartDay `json:"start_day"` - // An ISO8601 time string specifying when the restriction should start. - StartTime string `json:"start_time"` - // The day of the week on which the restriction should end, as its long-form name (e.g. "monday", "tuesday", etc). - EndDay EndDay `json:"end_day"` - // An ISO8601 time string specifying when the restriction should end. - EndTime string `json:"end_time"` -} - -func (o *Restrictions) GetStartDay() StartDay { - if o == nil { - return StartDay("") - } - return o.StartDay -} - -func (o *Restrictions) GetStartTime() string { - if o == nil { - return "" - } - return o.StartTime -} - -func (o *Restrictions) GetEndDay() EndDay { - if o == nil { - return EndDay("") - } - return o.EndDay -} - -func (o *Restrictions) GetEndTime() string { - if o == nil { - return "" - } - return o.EndTime -} - -// PostV1TeamsTeamIDOnCallSchedules - Create a Signals on-call schedule for a team. -type PostV1TeamsTeamIDOnCallSchedules struct { - // The on-call schedule's name. - Name string `json:"name"` - // A detailed description of the on-call schedule. - Description *string `json:"description,omitempty"` - // The time zone in which the on-call schedule operates. This value must be a valid IANA time zone name. - TimeZone string `json:"time_zone"` - // The ID of a Slack user group for syncing purposes. If provided, we will automatically sync whoever is on call to the user group in Slack. - SlackUserGroupID *string `json:"slack_user_group_id,omitempty"` - // An ordered list of objects that specify members of the on-call schedule's rotation. - Members []Members `json:"members,omitempty"` - // An object that specifies how the schedule's on-call shifts should be generated. - Strategy Strategy `json:"strategy"` - // A list of objects that restrict the schedule to speccific on-call periods. - Restrictions []Restrictions `json:"restrictions,omitempty"` - // An ISO8601 time string specifying when the schedule's first shift should start. This value is only used if the schedule's strategy is "custom". - StartTime *string `json:"start_time,omitempty"` - // A hex color code that will be used to represent the schedule in the UI and iCal subscriptions. - Color *string `json:"color,omitempty"` - // This parameter is deprecated; use `members` instead. - MemberIds []string `json:"member_ids,omitempty"` -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetTimeZone() string { - if o == nil { - return "" - } - return o.TimeZone -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetSlackUserGroupID() *string { - if o == nil { - return nil - } - return o.SlackUserGroupID -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetMembers() []Members { - if o == nil { - return nil - } - return o.Members -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetStrategy() Strategy { - if o == nil { - return Strategy{} - } - return o.Strategy -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetRestrictions() []Restrictions { - if o == nil { - return nil - } - return o.Restrictions -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetStartTime() *string { - if o == nil { - return nil - } - return o.StartTime -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetColor() *string { - if o == nil { - return nil - } - return o.Color -} - -func (o *PostV1TeamsTeamIDOnCallSchedules) GetMemberIds() []string { - if o == nil { - return nil - } - return o.MemberIds -} diff --git a/internal/sdk/models/shared/postv1teamsteamidoncallschedulesscheduleidshifts.go b/internal/sdk/models/shared/postv1teamsteamidoncallschedulesscheduleidshifts.go deleted file mode 100644 index c2af20b..0000000 --- a/internal/sdk/models/shared/postv1teamsteamidoncallschedulesscheduleidshifts.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts - Create a Signals on-call shift in a schedule. -type PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts struct { - // The start time of the shift in ISO8601 format. - StartTime string `json:"start_time"` - // The end time of the shift in ISO8601 format. - EndTime string `json:"end_time"` - // The ID of the user who is on-call for the shift. If not provided, the shift will be unassigned. - UserID *string `json:"user_id,omitempty"` -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts) GetStartTime() string { - if o == nil { - return "" - } - return o.StartTime -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts) GetEndTime() string { - if o == nil { - return "" - } - return o.EndTime -} - -func (o *PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} diff --git a/internal/sdk/models/shared/postv1teamsteamidsignalrules.go b/internal/sdk/models/shared/postv1teamsteamidsignalrules.go deleted file mode 100644 index c9d7645..0000000 --- a/internal/sdk/models/shared/postv1teamsteamidsignalrules.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -// TargetType - The type of target that the rule will notify when matched. -type TargetType string - -const ( - TargetTypeEscalationPolicy TargetType = "EscalationPolicy" - TargetTypeOnCallSchedule TargetType = "OnCallSchedule" - TargetTypeUser TargetType = "User" - TargetTypeWebhook TargetType = "Webhook" -) - -func (e TargetType) ToPointer() *TargetType { - return &e -} -func (e *TargetType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "EscalationPolicy": - fallthrough - case "OnCallSchedule": - fallthrough - case "User": - fallthrough - case "Webhook": - *e = TargetType(v) - return nil - default: - return fmt.Errorf("invalid value for TargetType: %v", v) - } -} - -// NotificationPriorityOverride - A notification priority that will be set on the resulting alert (default: HIGH) -type NotificationPriorityOverride string - -const ( - NotificationPriorityOverrideHigh NotificationPriorityOverride = "HIGH" - NotificationPriorityOverrideMedium NotificationPriorityOverride = "MEDIUM" - NotificationPriorityOverrideLow NotificationPriorityOverride = "LOW" - NotificationPriorityOverrideUnknown NotificationPriorityOverride = "" -) - -func (e NotificationPriorityOverride) ToPointer() *NotificationPriorityOverride { - return &e -} -func (e *NotificationPriorityOverride) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "HIGH": - fallthrough - case "MEDIUM": - fallthrough - case "LOW": - fallthrough - case "": - *e = NotificationPriorityOverride(v) - return nil - default: - return fmt.Errorf("invalid value for NotificationPriorityOverride: %v", v) - } -} - -// PostV1TeamsTeamIDSignalRules - Create a Signals rule for a team. -type PostV1TeamsTeamIDSignalRules struct { - // The rule's name. - Name string `json:"name"` - // The CEL expression that defines the rule. - Expression string `json:"expression"` - // The type of target that the rule will notify when matched. - TargetType TargetType `json:"target_type"` - // The ID of the target that the rule will notify when matched. - TargetID string `json:"target_id"` - // The ID of an incident type that should be used when an alert is promoted to an incident - IncidentTypeID *string `json:"incident_type_id,omitempty"` - // A notification priority that will be set on the resulting alert (default: HIGH) - NotificationPriorityOverride *NotificationPriorityOverride `json:"notification_priority_override,omitempty"` -} - -func (o *PostV1TeamsTeamIDSignalRules) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1TeamsTeamIDSignalRules) GetExpression() string { - if o == nil { - return "" - } - return o.Expression -} - -func (o *PostV1TeamsTeamIDSignalRules) GetTargetType() TargetType { - if o == nil { - return TargetType("") - } - return o.TargetType -} - -func (o *PostV1TeamsTeamIDSignalRules) GetTargetID() string { - if o == nil { - return "" - } - return o.TargetID -} - -func (o *PostV1TeamsTeamIDSignalRules) GetIncidentTypeID() *string { - if o == nil { - return nil - } - return o.IncidentTypeID -} - -func (o *PostV1TeamsTeamIDSignalRules) GetNotificationPriorityOverride() *NotificationPriorityOverride { - if o == nil { - return nil - } - return o.NotificationPriorityOverride -} diff --git a/internal/sdk/models/shared/postv1ticketingpriorities.go b/internal/sdk/models/shared/postv1ticketingpriorities.go deleted file mode 100644 index 74620de..0000000 --- a/internal/sdk/models/shared/postv1ticketingpriorities.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1TicketingPriorities - Create a single ticketing priority -type PostV1TicketingPriorities struct { - Name string `json:"name"` - // The position that this priority should take in your list of priorities. Priorities should be ordered from highest to lowest, with the highest priority at 0. If a position isn't specified, the new priority will be added to the end of the list; if another priority already exists at the specified position, that priority and all priorities following it will automatically be moved down the list to make room for the new priority. - Position *int `json:"position,omitempty"` -} - -func (o *PostV1TicketingPriorities) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PostV1TicketingPriorities) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/postv1ticketingtickets.go b/internal/sdk/models/shared/postv1ticketingtickets.go deleted file mode 100644 index 287187c..0000000 --- a/internal/sdk/models/shared/postv1ticketingtickets.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1TicketingTickets - Creates a ticket for a project -type PostV1TicketingTickets struct { - Summary string `json:"summary"` - // Which incident this ticket is related to, in the format of 'incident/UUID' - RelatedTo *string `json:"related_to,omitempty"` - ProjectID *string `json:"project_id,omitempty"` - Description *string `json:"description,omitempty"` - State *string `json:"state,omitempty"` - Type *string `json:"type,omitempty"` - PriorityID *string `json:"priority_id,omitempty"` - // List of tags for the ticket - TagList []string `json:"tag_list,omitempty"` - // The remote URL for an existing ticket in a supported and configured ticketing integration - RemoteURL *string `json:"remote_url,omitempty"` -} - -func (o *PostV1TicketingTickets) GetSummary() string { - if o == nil { - return "" - } - return o.Summary -} - -func (o *PostV1TicketingTickets) GetRelatedTo() *string { - if o == nil { - return nil - } - return o.RelatedTo -} - -func (o *PostV1TicketingTickets) GetProjectID() *string { - if o == nil { - return nil - } - return o.ProjectID -} - -func (o *PostV1TicketingTickets) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PostV1TicketingTickets) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *PostV1TicketingTickets) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *PostV1TicketingTickets) GetPriorityID() *string { - if o == nil { - return nil - } - return o.PriorityID -} - -func (o *PostV1TicketingTickets) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} - -func (o *PostV1TicketingTickets) GetRemoteURL() *string { - if o == nil { - return nil - } - return o.RemoteURL -} diff --git a/internal/sdk/models/shared/postv1webhooks.go b/internal/sdk/models/shared/postv1webhooks.go deleted file mode 100644 index f86f4cf..0000000 --- a/internal/sdk/models/shared/postv1webhooks.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PostV1Webhooks - Create a new webhook -type PostV1Webhooks struct { - URL string `json:"url"` -} - -func (o *PostV1Webhooks) GetURL() string { - if o == nil { - return "" - } - return o.URL -} diff --git a/internal/sdk/models/shared/priorityentity.go b/internal/sdk/models/shared/priorityentity.go deleted file mode 100644 index 3b9a2dc..0000000 --- a/internal/sdk/models/shared/priorityentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// PriorityEntity model -type PriorityEntity struct { - Slug *string `json:"slug,omitempty"` - Description *string `json:"description,omitempty"` - Position *int `json:"position,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - Default *bool `json:"default,omitempty"` -} - -func (p PriorityEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PriorityEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PriorityEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *PriorityEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PriorityEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *PriorityEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *PriorityEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *PriorityEntity) GetDefault() *bool { - if o == nil { - return nil - } - return o.Default -} diff --git a/internal/sdk/models/shared/publicapiv1incidentssuccinctentity.go b/internal/sdk/models/shared/publicapiv1incidentssuccinctentity.go deleted file mode 100644 index 6652470..0000000 --- a/internal/sdk/models/shared/publicapiv1incidentssuccinctentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PublicAPIV1IncidentsSuccinctEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Number *string `json:"number,omitempty"` -} - -func (o *PublicAPIV1IncidentsSuccinctEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PublicAPIV1IncidentsSuccinctEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PublicAPIV1IncidentsSuccinctEntity) GetNumber() *string { - if o == nil { - return nil - } - return o.Number -} diff --git a/internal/sdk/models/shared/publicapiv1incidentstranscriptentity.go b/internal/sdk/models/shared/publicapiv1incidentstranscriptentity.go deleted file mode 100644 index e32894a..0000000 --- a/internal/sdk/models/shared/publicapiv1incidentstranscriptentity.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// PublicAPIV1IncidentsTranscriptEntity - PublicAPI_V1_Incidents_TranscriptEntity model -type PublicAPIV1IncidentsTranscriptEntity struct { - // The unique identifier for the transcript entry - ID *string `json:"id,omitempty"` - // The speaker for the transcript entry - Speaker *string `json:"speaker,omitempty"` - // The start time for the transcript entry - Start *int `json:"start,omitempty"` - // The end time for the transcript entry - Until *int `json:"until,omitempty"` - // The words spoken for the transcript entry - Words *string `json:"words,omitempty"` - // The time the transcript entry was created - CreatedAt *time.Time `json:"created_at,omitempty"` - // The time the transcript entry was last updated - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (p PublicAPIV1IncidentsTranscriptEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PublicAPIV1IncidentsTranscriptEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PublicAPIV1IncidentsTranscriptEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PublicAPIV1IncidentsTranscriptEntity) GetSpeaker() *string { - if o == nil { - return nil - } - return o.Speaker -} - -func (o *PublicAPIV1IncidentsTranscriptEntity) GetStart() *int { - if o == nil { - return nil - } - return o.Start -} - -func (o *PublicAPIV1IncidentsTranscriptEntity) GetUntil() *int { - if o == nil { - return nil - } - return o.Until -} - -func (o *PublicAPIV1IncidentsTranscriptEntity) GetWords() *string { - if o == nil { - return nil - } - return o.Words -} - -func (o *PublicAPIV1IncidentsTranscriptEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *PublicAPIV1IncidentsTranscriptEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} diff --git a/internal/sdk/models/shared/putv1incidentsincidentidimpact.go b/internal/sdk/models/shared/putv1incidentsincidentidimpact.go deleted file mode 100644 index 20a7532..0000000 --- a/internal/sdk/models/shared/putv1incidentsincidentidimpact.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PutV1IncidentsIncidentIDImpactImpact struct { - ID string `json:"id"` - ConditionID string `json:"condition_id"` -} - -func (o *PutV1IncidentsIncidentIDImpactImpact) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PutV1IncidentsIncidentIDImpactImpact) GetConditionID() string { - if o == nil { - return "" - } - return o.ConditionID -} - -type PutV1IncidentsIncidentIDImpactStatusPages struct { - ID string `json:"id"` - IntegrationSlug string `json:"integration_slug"` -} - -func (o *PutV1IncidentsIncidentIDImpactStatusPages) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *PutV1IncidentsIncidentIDImpactStatusPages) GetIntegrationSlug() string { - if o == nil { - return "" - } - return o.IntegrationSlug -} - -// PutV1IncidentsIncidentIDImpact - Allows updating an incident's impacted infrastructure, with the option to -// move the incident into a different milestone and provide a note to update -// the incident timeline and any attached status pages. If this method is -// requested with the PUT verb, impacts will be completely replaced with the -// information in the request body, even if not provided (effectively clearing -// all impacts). If this method is requested with the PATCH verb, the provided -// impacts will be added or updated, but no impacts will be removed. -type PutV1IncidentsIncidentIDImpact struct { - Note *string `json:"note,omitempty"` - Milestone *string `json:"milestone,omitempty"` - Impact []PutV1IncidentsIncidentIDImpactImpact `json:"impact,omitempty"` - StatusPages []PutV1IncidentsIncidentIDImpactStatusPages `json:"status_pages,omitempty"` -} - -func (o *PutV1IncidentsIncidentIDImpact) GetNote() *string { - if o == nil { - return nil - } - return o.Note -} - -func (o *PutV1IncidentsIncidentIDImpact) GetMilestone() *string { - if o == nil { - return nil - } - return o.Milestone -} - -func (o *PutV1IncidentsIncidentIDImpact) GetImpact() []PutV1IncidentsIncidentIDImpactImpact { - if o == nil { - return nil - } - return o.Impact -} - -func (o *PutV1IncidentsIncidentIDImpact) GetStatusPages() []PutV1IncidentsIncidentIDImpactStatusPages { - if o == nil { - return nil - } - return o.StatusPages -} diff --git a/internal/sdk/models/shared/putv1incidentsincidentidlinkslinkid.go b/internal/sdk/models/shared/putv1incidentsincidentidlinkslinkid.go deleted file mode 100644 index 38b1a42..0000000 --- a/internal/sdk/models/shared/putv1incidentsincidentidlinkslinkid.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PutV1IncidentsIncidentIDLinksLinkID - Updates the external incident link attributes -type PutV1IncidentsIncidentIDLinksLinkID struct { - DisplayText *string `json:"display_text,omitempty"` - IconURL *string `json:"icon_url,omitempty"` - HrefURL *string `json:"href_url,omitempty"` -} - -func (o *PutV1IncidentsIncidentIDLinksLinkID) GetDisplayText() *string { - if o == nil { - return nil - } - return o.DisplayText -} - -func (o *PutV1IncidentsIncidentIDLinksLinkID) GetIconURL() *string { - if o == nil { - return nil - } - return o.IconURL -} - -func (o *PutV1IncidentsIncidentIDLinksLinkID) GetHrefURL() *string { - if o == nil { - return nil - } - return o.HrefURL -} diff --git a/internal/sdk/models/shared/putv1incidentsincidentidmilestonesbulkupdate.go b/internal/sdk/models/shared/putv1incidentsincidentidmilestonesbulkupdate.go deleted file mode 100644 index 152f2c1..0000000 --- a/internal/sdk/models/shared/putv1incidentsincidentidmilestonesbulkupdate.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type Bulk string - -const ( - BulkTrue Bulk = "true" -) - -func (e Bulk) ToPointer() *Bulk { - return &e -} -func (e *Bulk) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "true": - *e = Bulk(v) - return nil - default: - return fmt.Errorf("invalid value for Bulk: %v", v) - } -} - -type PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones struct { - // The type/slug of the milestone. Must be one of the currently configured milestones for the given incident. - Type string `json:"type"` - // An ISO8601 formatted string for when this milestone occurred. If you are removing a milestone, this field still needs to be set to some value - OccurredAt time.Time `json:"occurred_at"` - // If set to true, the milestone will be removed from the incident - Remove *bool `json:"remove,omitempty"` -} - -func (p PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones) GetType() string { - if o == nil { - return "" - } - return o.Type -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones) GetOccurredAt() time.Time { - if o == nil { - return time.Time{} - } - return o.OccurredAt -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones) GetRemove() *bool { - if o == nil { - return nil - } - return o.Remove -} - -// PutV1IncidentsIncidentIDMilestonesBulkUpdate - Update milestone times in bulk for a given incident. All milestone -// times for an incident must occur in chronological order -// corresponding to the configured order of milestones. If the result -// of this request would cause any milestone(s) to appear out of place, -// a 422 response will instead be returned. This includes milestones -// not explicitly submitted or updated in this request. -type PutV1IncidentsIncidentIDMilestonesBulkUpdate struct { - Bulk *Bulk `json:"bulk,omitempty"` - Milestones []PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones `json:"milestones"` -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdate) GetBulk() *Bulk { - if o == nil { - return nil - } - return o.Bulk -} - -func (o *PutV1IncidentsIncidentIDMilestonesBulkUpdate) GetMilestones() []PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones { - if o == nil { - return []PutV1IncidentsIncidentIDMilestonesBulkUpdateMilestones{} - } - return o.Milestones -} diff --git a/internal/sdk/models/shared/putv1postmortemsquestions.go b/internal/sdk/models/shared/putv1postmortemsquestions.go deleted file mode 100644 index 0d34558..0000000 --- a/internal/sdk/models/shared/putv1postmortemsquestions.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PutV1PostMortemsQuestionsQuestions struct { - // ID of a question - ID *string `json:"id,omitempty"` - // title of a question - Title *string `json:"title,omitempty"` - // tooltip of a question - Tooltip *string `json:"tooltip,omitempty"` -} - -func (o *PutV1PostMortemsQuestionsQuestions) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *PutV1PostMortemsQuestionsQuestions) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *PutV1PostMortemsQuestionsQuestions) GetTooltip() *string { - if o == nil { - return nil - } - return o.Tooltip -} - -// PutV1PostMortemsQuestions - Update the questions configured to be provided and filled out on future retrospective reports. -type PutV1PostMortemsQuestions struct { - MakeSwaggerWork *string `json:"_make_swagger_work_,omitempty"` - Questions []PutV1PostMortemsQuestionsQuestions `json:"questions,omitempty"` -} - -func (o *PutV1PostMortemsQuestions) GetMakeSwaggerWork() *string { - if o == nil { - return nil - } - return o.MakeSwaggerWork -} - -func (o *PutV1PostMortemsQuestions) GetQuestions() []PutV1PostMortemsQuestionsQuestions { - if o == nil { - return nil - } - return o.Questions -} diff --git a/internal/sdk/models/shared/putv1postmortemsreportsreportidreasonsorder.go b/internal/sdk/models/shared/putv1postmortemsreportsreportidreasonsorder.go deleted file mode 100644 index 164961a..0000000 --- a/internal/sdk/models/shared/putv1postmortemsreportsreportidreasonsorder.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PutV1PostMortemsReportsReportIDReasonsOrder - Reorder a contributing factor -type PutV1PostMortemsReportsReportIDReasonsOrder struct { - OldPosition int `json:"old_position"` - NewPosition int `json:"new_position"` -} - -func (o *PutV1PostMortemsReportsReportIDReasonsOrder) GetOldPosition() int { - if o == nil { - return 0 - } - return o.OldPosition -} - -func (o *PutV1PostMortemsReportsReportIDReasonsOrder) GetNewPosition() int { - if o == nil { - return 0 - } - return o.NewPosition -} diff --git a/internal/sdk/models/shared/putv1runbooksexecutionsexecutionidstepsstepid.go b/internal/sdk/models/shared/putv1runbooksexecutionsexecutionidstepsstepid.go deleted file mode 100644 index 609c05d..0000000 --- a/internal/sdk/models/shared/putv1runbooksexecutionsexecutionidstepsstepid.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// PutV1RunbooksExecutionsExecutionIDStepsStepID - Updates a runbook step execution, especially for changing the state of a step execution. -type PutV1RunbooksExecutionsExecutionIDStepsStepID struct { - State string `json:"state"` - ScheduleFor *time.Time `json:"schedule_for,omitempty"` - // Data for execution of this step - Data map[string]any `json:"data,omitempty"` - RepeatsAt *time.Time `json:"repeats_at,omitempty"` -} - -func (p PutV1RunbooksExecutionsExecutionIDStepsStepID) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PutV1RunbooksExecutionsExecutionIDStepsStepID) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepID) GetState() string { - if o == nil { - return "" - } - return o.State -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepID) GetScheduleFor() *time.Time { - if o == nil { - return nil - } - return o.ScheduleFor -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepID) GetData() map[string]any { - if o == nil { - return nil - } - return o.Data -} - -func (o *PutV1RunbooksExecutionsExecutionIDStepsStepID) GetRepeatsAt() *time.Time { - if o == nil { - return nil - } - return o.RepeatsAt -} diff --git a/internal/sdk/models/shared/putv1runbooksrunbookid.go b/internal/sdk/models/shared/putv1runbooksrunbookid.go deleted file mode 100644 index 5c75ffc..0000000 --- a/internal/sdk/models/shared/putv1runbooksrunbookid.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// PutV1RunbooksRunbookIDOwner - An object representing a Team that owns the runbook -type PutV1RunbooksRunbookIDOwner struct { - ID *string `json:"id,omitempty"` -} - -func (o *PutV1RunbooksRunbookIDOwner) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -type PutV1RunbooksRunbookIDSeverities struct { - ID *string `json:"id,omitempty"` -} - -func (o *PutV1RunbooksRunbookIDSeverities) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -type PutV1RunbooksRunbookIDServices struct { - ID *string `json:"id,omitempty"` -} - -func (o *PutV1RunbooksRunbookIDServices) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -type Environments struct { - ID *string `json:"id,omitempty"` -} - -func (o *Environments) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -type PutV1RunbooksRunbookIDAttachmentRule struct { - // The JSON logic for the attaching the runbook - Logic string `json:"logic"` - // The user data for the rule - UserData *string `json:"user_data,omitempty"` -} - -func (o *PutV1RunbooksRunbookIDAttachmentRule) GetLogic() string { - if o == nil { - return "" - } - return o.Logic -} - -func (o *PutV1RunbooksRunbookIDAttachmentRule) GetUserData() *string { - if o == nil { - return nil - } - return o.UserData -} - -type PutV1RunbooksRunbookIDRule struct { - // The JSON logic for the rule - Logic string `json:"logic"` - // The user data for the rule - UserData *string `json:"user_data,omitempty"` -} - -func (o *PutV1RunbooksRunbookIDRule) GetLogic() string { - if o == nil { - return "" - } - return o.Logic -} - -func (o *PutV1RunbooksRunbookIDRule) GetUserData() *string { - if o == nil { - return nil - } - return o.UserData -} - -type PutV1RunbooksRunbookIDSteps struct { - // ID of step to be updated - StepID *string `json:"step_id,omitempty"` - // Name for step - Name string `json:"name"` - // ID of action to use for this step. - ActionID string `json:"action_id"` - Rule *PutV1RunbooksRunbookIDRule `json:"rule,omitempty"` -} - -func (o *PutV1RunbooksRunbookIDSteps) GetStepID() *string { - if o == nil { - return nil - } - return o.StepID -} - -func (o *PutV1RunbooksRunbookIDSteps) GetName() string { - if o == nil { - return "" - } - return o.Name -} - -func (o *PutV1RunbooksRunbookIDSteps) GetActionID() string { - if o == nil { - return "" - } - return o.ActionID -} - -func (o *PutV1RunbooksRunbookIDSteps) GetRule() *PutV1RunbooksRunbookIDRule { - if o == nil { - return nil - } - return o.Rule -} - -// PutV1RunbooksRunbookID - Update a runbook and any attachment rules associated with it. This endpoint is used to configure nearly everything -// about a runbook, including but not limited to the steps, environments, attachment rules, and severities. -type PutV1RunbooksRunbookID struct { - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - // Whether or not this runbook is a tutorial runbook - Tutorial *bool `json:"tutorial,omitempty"` - // An object representing a Team that owns the runbook - Owner *PutV1RunbooksRunbookIDOwner `json:"owner,omitempty"` - Severities []PutV1RunbooksRunbookIDSeverities `json:"severities,omitempty"` - Services []PutV1RunbooksRunbookIDServices `json:"services,omitempty"` - Environments []Environments `json:"environments,omitempty"` - AttachmentRule *PutV1RunbooksRunbookIDAttachmentRule `json:"attachment_rule,omitempty"` - Steps []PutV1RunbooksRunbookIDSteps `json:"steps,omitempty"` - // Whether or not this runbook should be automatically attached to restricted incidents. Note that setting this to `true` will prevent it from being attached to public incidents, even manually. Defaults to `false`. - AutoAttachToRestrictedIncidents *bool `json:"auto_attach_to_restricted_incidents,omitempty"` -} - -func (o *PutV1RunbooksRunbookID) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *PutV1RunbooksRunbookID) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *PutV1RunbooksRunbookID) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *PutV1RunbooksRunbookID) GetTutorial() *bool { - if o == nil { - return nil - } - return o.Tutorial -} - -func (o *PutV1RunbooksRunbookID) GetOwner() *PutV1RunbooksRunbookIDOwner { - if o == nil { - return nil - } - return o.Owner -} - -func (o *PutV1RunbooksRunbookID) GetSeverities() []PutV1RunbooksRunbookIDSeverities { - if o == nil { - return nil - } - return o.Severities -} - -func (o *PutV1RunbooksRunbookID) GetServices() []PutV1RunbooksRunbookIDServices { - if o == nil { - return nil - } - return o.Services -} - -func (o *PutV1RunbooksRunbookID) GetEnvironments() []Environments { - if o == nil { - return nil - } - return o.Environments -} - -func (o *PutV1RunbooksRunbookID) GetAttachmentRule() *PutV1RunbooksRunbookIDAttachmentRule { - if o == nil { - return nil - } - return o.AttachmentRule -} - -func (o *PutV1RunbooksRunbookID) GetSteps() []PutV1RunbooksRunbookIDSteps { - if o == nil { - return nil - } - return o.Steps -} - -func (o *PutV1RunbooksRunbookID) GetAutoAttachToRestrictedIncidents() *bool { - if o == nil { - return nil - } - return o.AutoAttachToRestrictedIncidents -} diff --git a/internal/sdk/models/shared/putv1scimv2groupsid.go b/internal/sdk/models/shared/putv1scimv2groupsid.go deleted file mode 100644 index f333e3e..0000000 --- a/internal/sdk/models/shared/putv1scimv2groupsid.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type PutV1ScimV2GroupsIDMembers struct { - // String that represents the user's UUID to assign to the team - Value string `json:"value"` -} - -func (o *PutV1ScimV2GroupsIDMembers) GetValue() string { - if o == nil { - return "" - } - return o.Value -} - -// PutV1ScimV2GroupsID - SCIM endpoint to update a Team (Colloquial for Group in the SCIM protocol). Any members defined in the payload will be assigned to the team with no defined role, any missing members will be removed from the team. -type PutV1ScimV2GroupsID struct { - // The name of the team being updated - DisplayName string `json:"displayName"` - Members []PutV1ScimV2GroupsIDMembers `json:"members"` -} - -func (o *PutV1ScimV2GroupsID) GetDisplayName() string { - if o == nil { - return "" - } - return o.DisplayName -} - -func (o *PutV1ScimV2GroupsID) GetMembers() []PutV1ScimV2GroupsIDMembers { - if o == nil { - return []PutV1ScimV2GroupsIDMembers{} - } - return o.Members -} diff --git a/internal/sdk/models/shared/putv1scimv2usersid.go b/internal/sdk/models/shared/putv1scimv2usersid.go deleted file mode 100644 index 4fc3be2..0000000 --- a/internal/sdk/models/shared/putv1scimv2usersid.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// Name - The components of the user's name -type Name struct { - // The family name of the User, or last name in most Western languages - GivenName string `json:"givenName"` - // The given name of the User, or first name in most Western languages - FamilyName string `json:"familyName"` -} - -func (o *Name) GetGivenName() string { - if o == nil { - return "" - } - return o.GivenName -} - -func (o *Name) GetFamilyName() string { - if o == nil { - return "" - } - return o.FamilyName -} - -type Emails struct { - // String that represents an email address for the User - Value string `json:"value"` - // Boolean which signifies if an email is intended as the primary email for the User - Primary *bool `json:"primary,omitempty"` -} - -func (o *Emails) GetValue() string { - if o == nil { - return "" - } - return o.Value -} - -func (o *Emails) GetPrimary() *bool { - if o == nil { - return nil - } - return o.Primary -} - -// PutV1ScimV2UsersID - PUT SCIM endpoint to update a User. This endpoint is used to replace a resource's attributes. -type PutV1ScimV2UsersID struct { - // A service provider's unique identifier for the user - UserName *string `json:"userName,omitempty"` - // The components of the user's name - Name *Name `json:"name,omitempty"` - // Email addresses for the User - Emails []Emails `json:"emails,omitempty"` - // Roles for the User - Roles []string `json:"roles,omitempty"` - // Boolean that represents whether user is active - Active *bool `json:"active,omitempty"` -} - -func (o *PutV1ScimV2UsersID) GetUserName() *string { - if o == nil { - return nil - } - return o.UserName -} - -func (o *PutV1ScimV2UsersID) GetName() *Name { - if o == nil { - return nil - } - return o.Name -} - -func (o *PutV1ScimV2UsersID) GetEmails() []Emails { - if o == nil { - return nil - } - return o.Emails -} - -func (o *PutV1ScimV2UsersID) GetRoles() []string { - if o == nil { - return nil - } - return o.Roles -} - -func (o *PutV1ScimV2UsersID) GetActive() *bool { - if o == nil { - return nil - } - return o.Active -} diff --git a/internal/sdk/models/shared/reportentity.go b/internal/sdk/models/shared/reportentity.go deleted file mode 100644 index c61e488..0000000 --- a/internal/sdk/models/shared/reportentity.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/types" -) - -// ReportEntity model -type ReportEntity struct { - Data []ReportsBucketEntity `json:"data,omitempty"` - StartDate *types.Date `json:"start_date,omitempty"` - EndDate *types.Date `json:"end_date,omitempty"` - BucketPeriod *string `json:"bucket_period,omitempty"` -} - -func (r ReportEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) -} - -func (r *ReportEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ReportEntity) GetData() []ReportsBucketEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *ReportEntity) GetStartDate() *types.Date { - if o == nil { - return nil - } - return o.StartDate -} - -func (o *ReportEntity) GetEndDate() *types.Date { - if o == nil { - return nil - } - return o.EndDate -} - -func (o *ReportEntity) GetBucketPeriod() *string { - if o == nil { - return nil - } - return o.BucketPeriod -} diff --git a/internal/sdk/models/shared/reportsbucketentity.go b/internal/sdk/models/shared/reportsbucketentity.go deleted file mode 100644 index 9f7cc97..0000000 --- a/internal/sdk/models/shared/reportsbucketentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ReportsBucketEntity struct { - Bucket *string `json:"bucket,omitempty"` - Points []ReportsDataPointEntity `json:"points,omitempty"` -} - -func (o *ReportsBucketEntity) GetBucket() *string { - if o == nil { - return nil - } - return o.Bucket -} - -func (o *ReportsBucketEntity) GetPoints() []ReportsDataPointEntity { - if o == nil { - return nil - } - return o.Points -} diff --git a/internal/sdk/models/shared/reportsdatapointentity.go b/internal/sdk/models/shared/reportsdatapointentity.go deleted file mode 100644 index 1a3cbd9..0000000 --- a/internal/sdk/models/shared/reportsdatapointentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ReportsDataPointEntity struct { - Key *string `json:"key,omitempty"` - Value *int `json:"value,omitempty"` -} - -func (o *ReportsDataPointEntity) GetKey() *string { - if o == nil { - return nil - } - return o.Key -} - -func (o *ReportsDataPointEntity) GetValue() *int { - if o == nil { - return nil - } - return o.Value -} diff --git a/internal/sdk/models/shared/rulesruleentity.go b/internal/sdk/models/shared/rulesruleentity.go deleted file mode 100644 index d45bddf..0000000 --- a/internal/sdk/models/shared/rulesruleentity.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// Logic - An unstructured object of key/value pairs describing the logic for applying the rule. -type Logic struct { -} - -type RulesRuleEntity struct { - // An unstructured object of key/value pairs describing the logic for applying the rule. - Logic *Logic `json:"logic,omitempty"` - UserData *FHTypesGenericEntity `json:"user_data,omitempty"` -} - -func (o *RulesRuleEntity) GetLogic() *Logic { - if o == nil { - return nil - } - return o.Logic -} - -func (o *RulesRuleEntity) GetUserData() *FHTypesGenericEntity { - if o == nil { - return nil - } - return o.UserData -} diff --git a/internal/sdk/models/shared/runbookentity.go b/internal/sdk/models/shared/runbookentity.go deleted file mode 100644 index 612b183..0000000 --- a/internal/sdk/models/shared/runbookentity.go +++ /dev/null @@ -1,170 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// RunbookEntity model -type RunbookEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - RunbookTemplateID *string `json:"runbook_template_id,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - UpdatedBy *AuthorEntity `json:"updated_by,omitempty"` - Steps *RunbookStepEntity `json:"steps,omitempty"` - AttachmentRule *RulesRuleEntity `json:"attachment_rule,omitempty"` - // VotesEntity model - Votes *VotesEntity `json:"votes,omitempty"` - IsEditable *bool `json:"is_editable,omitempty"` - // TeamEntity model - Owner *TeamEntity `json:"owner,omitempty"` - // categories the runbook applies to - Categories *string `json:"categories,omitempty"` - AutoAttachToRestrictedIncidents *bool `json:"auto_attach_to_restricted_incidents,omitempty"` - Tutorial *bool `json:"tutorial,omitempty"` -} - -func (r RunbookEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) -} - -func (r *RunbookEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { - return err - } - return nil -} - -func (o *RunbookEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *RunbookEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *RunbookEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *RunbookEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *RunbookEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *RunbookEntity) GetRunbookTemplateID() *string { - if o == nil { - return nil - } - return o.RunbookTemplateID -} - -func (o *RunbookEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *RunbookEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *RunbookEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *RunbookEntity) GetUpdatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.UpdatedBy -} - -func (o *RunbookEntity) GetSteps() *RunbookStepEntity { - if o == nil { - return nil - } - return o.Steps -} - -func (o *RunbookEntity) GetAttachmentRule() *RulesRuleEntity { - if o == nil { - return nil - } - return o.AttachmentRule -} - -func (o *RunbookEntity) GetVotes() *VotesEntity { - if o == nil { - return nil - } - return o.Votes -} - -func (o *RunbookEntity) GetIsEditable() *bool { - if o == nil { - return nil - } - return o.IsEditable -} - -func (o *RunbookEntity) GetOwner() *TeamEntity { - if o == nil { - return nil - } - return o.Owner -} - -func (o *RunbookEntity) GetCategories() *string { - if o == nil { - return nil - } - return o.Categories -} - -func (o *RunbookEntity) GetAutoAttachToRestrictedIncidents() *bool { - if o == nil { - return nil - } - return o.AutoAttachToRestrictedIncidents -} - -func (o *RunbookEntity) GetTutorial() *bool { - if o == nil { - return nil - } - return o.Tutorial -} diff --git a/internal/sdk/models/shared/runbooksactionconfigentity.go b/internal/sdk/models/shared/runbooksactionconfigentity.go deleted file mode 100644 index e1ef1ad..0000000 --- a/internal/sdk/models/shared/runbooksactionconfigentity.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksActionConfigEntity struct { - Elements *RunbooksElementEntity `json:"elements,omitempty"` - // Location of documentation for this action - DocumentationURL *string `json:"documentation_url,omitempty"` -} - -func (o *RunbooksActionConfigEntity) GetElements() *RunbooksElementEntity { - if o == nil { - return nil - } - return o.Elements -} - -func (o *RunbooksActionConfigEntity) GetDocumentationURL() *string { - if o == nil { - return nil - } - return o.DocumentationURL -} diff --git a/internal/sdk/models/shared/runbooksactionsentity.go b/internal/sdk/models/shared/runbooksactionsentity.go deleted file mode 100644 index 842288c..0000000 --- a/internal/sdk/models/shared/runbooksactionsentity.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type Prerequisites struct { -} - -type DefaultLogic struct { -} - -type DefaultRuleData struct { -} - -type RunbooksActionsEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Slug *string `json:"slug,omitempty"` - Description *string `json:"description,omitempty"` - Config *RunbooksActionConfigEntity `json:"config,omitempty"` - Category *string `json:"category,omitempty"` - Prerequisites *Prerequisites `json:"prerequisites,omitempty"` - // Integrations_IntegrationEntity model - Integration *IntegrationsIntegrationEntity `json:"integration,omitempty"` - SupportedRunbookTypes []string `json:"supported_runbook_types,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - Automatable *bool `json:"automatable,omitempty"` - Rerunnable *bool `json:"rerunnable,omitempty"` - Repeatable *bool `json:"repeatable,omitempty"` - DefaultLogic *DefaultLogic `json:"default_logic,omitempty"` - DefaultRuleData *DefaultRuleData `json:"default_rule_data,omitempty"` -} - -func (r RunbooksActionsEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) -} - -func (r *RunbooksActionsEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { - return err - } - return nil -} - -func (o *RunbooksActionsEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *RunbooksActionsEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *RunbooksActionsEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *RunbooksActionsEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *RunbooksActionsEntity) GetConfig() *RunbooksActionConfigEntity { - if o == nil { - return nil - } - return o.Config -} - -func (o *RunbooksActionsEntity) GetCategory() *string { - if o == nil { - return nil - } - return o.Category -} - -func (o *RunbooksActionsEntity) GetPrerequisites() *Prerequisites { - if o == nil { - return nil - } - return o.Prerequisites -} - -func (o *RunbooksActionsEntity) GetIntegration() *IntegrationsIntegrationEntity { - if o == nil { - return nil - } - return o.Integration -} - -func (o *RunbooksActionsEntity) GetSupportedRunbookTypes() []string { - if o == nil { - return nil - } - return o.SupportedRunbookTypes -} - -func (o *RunbooksActionsEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *RunbooksActionsEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *RunbooksActionsEntity) GetAutomatable() *bool { - if o == nil { - return nil - } - return o.Automatable -} - -func (o *RunbooksActionsEntity) GetRerunnable() *bool { - if o == nil { - return nil - } - return o.Rerunnable -} - -func (o *RunbooksActionsEntity) GetRepeatable() *bool { - if o == nil { - return nil - } - return o.Repeatable -} - -func (o *RunbooksActionsEntity) GetDefaultLogic() *DefaultLogic { - if o == nil { - return nil - } - return o.DefaultLogic -} - -func (o *RunbooksActionsEntity) GetDefaultRuleData() *DefaultRuleData { - if o == nil { - return nil - } - return o.DefaultRuleData -} diff --git a/internal/sdk/models/shared/runbooksactionsentitypaginated.go b/internal/sdk/models/shared/runbooksactionsentitypaginated.go deleted file mode 100644 index ed9def1..0000000 --- a/internal/sdk/models/shared/runbooksactionsentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// RunbooksActionsEntityPaginated - Runbooks_ActionsEntityPaginated model -type RunbooksActionsEntityPaginated struct { - Data []RunbooksActionsEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *RunbooksActionsEntityPaginated) GetData() []RunbooksActionsEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *RunbooksActionsEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/runbookselementdynamicselectentity.go b/internal/sdk/models/shared/runbookselementdynamicselectentity.go deleted file mode 100644 index f876e70..0000000 --- a/internal/sdk/models/shared/runbookselementdynamicselectentity.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksElementDynamicSelectEntity struct { - Label *string `json:"label,omitempty"` - Placeholder *string `json:"placeholder,omitempty"` - AsyncURL *string `json:"async_url,omitempty"` - Required *bool `json:"required,omitempty"` - Clearable *bool `json:"clearable,omitempty"` - IsMulti *bool `json:"is_multi,omitempty"` - DefaultValue *RunbooksElementDynamicSelectEntitySelectOptionEntity `json:"default_value,omitempty"` - Options []RunbooksElementDynamicSelectEntitySelectOptionEntity `json:"options,omitempty"` -} - -func (o *RunbooksElementDynamicSelectEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} - -func (o *RunbooksElementDynamicSelectEntity) GetPlaceholder() *string { - if o == nil { - return nil - } - return o.Placeholder -} - -func (o *RunbooksElementDynamicSelectEntity) GetAsyncURL() *string { - if o == nil { - return nil - } - return o.AsyncURL -} - -func (o *RunbooksElementDynamicSelectEntity) GetRequired() *bool { - if o == nil { - return nil - } - return o.Required -} - -func (o *RunbooksElementDynamicSelectEntity) GetClearable() *bool { - if o == nil { - return nil - } - return o.Clearable -} - -func (o *RunbooksElementDynamicSelectEntity) GetIsMulti() *bool { - if o == nil { - return nil - } - return o.IsMulti -} - -func (o *RunbooksElementDynamicSelectEntity) GetDefaultValue() *RunbooksElementDynamicSelectEntitySelectOptionEntity { - if o == nil { - return nil - } - return o.DefaultValue -} - -func (o *RunbooksElementDynamicSelectEntity) GetOptions() []RunbooksElementDynamicSelectEntitySelectOptionEntity { - if o == nil { - return nil - } - return o.Options -} diff --git a/internal/sdk/models/shared/runbookselementdynamicselectentityselectoptionentity.go b/internal/sdk/models/shared/runbookselementdynamicselectentityselectoptionentity.go deleted file mode 100644 index 0628b1b..0000000 --- a/internal/sdk/models/shared/runbookselementdynamicselectentityselectoptionentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksElementDynamicSelectEntitySelectOptionEntity struct { - Label *string `json:"label,omitempty"` - Value *string `json:"value,omitempty"` -} - -func (o *RunbooksElementDynamicSelectEntitySelectOptionEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} - -func (o *RunbooksElementDynamicSelectEntitySelectOptionEntity) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} diff --git a/internal/sdk/models/shared/runbookselemententity.go b/internal/sdk/models/shared/runbookselemententity.go deleted file mode 100644 index 3b523ef..0000000 --- a/internal/sdk/models/shared/runbookselemententity.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksElementEntity struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Markdown *RunbooksElementMarkdownEntity `json:"markdown,omitempty"` - Textarea *RunbooksElementTextareaEntity `json:"textarea,omitempty"` - Input *RunbooksElementInputEntity `json:"input,omitempty"` - PlainText *RunbooksElementMarkdownEntity `json:"plain_text,omitempty"` - DynamicSelect *RunbooksElementDynamicSelectEntity `json:"dynamic_select,omitempty"` -} - -func (o *RunbooksElementEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *RunbooksElementEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *RunbooksElementEntity) GetMarkdown() *RunbooksElementMarkdownEntity { - if o == nil { - return nil - } - return o.Markdown -} - -func (o *RunbooksElementEntity) GetTextarea() *RunbooksElementTextareaEntity { - if o == nil { - return nil - } - return o.Textarea -} - -func (o *RunbooksElementEntity) GetInput() *RunbooksElementInputEntity { - if o == nil { - return nil - } - return o.Input -} - -func (o *RunbooksElementEntity) GetPlainText() *RunbooksElementMarkdownEntity { - if o == nil { - return nil - } - return o.PlainText -} - -func (o *RunbooksElementEntity) GetDynamicSelect() *RunbooksElementDynamicSelectEntity { - if o == nil { - return nil - } - return o.DynamicSelect -} diff --git a/internal/sdk/models/shared/runbookselementinputentity.go b/internal/sdk/models/shared/runbookselementinputentity.go deleted file mode 100644 index 8ef258f..0000000 --- a/internal/sdk/models/shared/runbookselementinputentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksElementInputEntity struct { - Label *string `json:"label,omitempty"` - Placeholder *string `json:"placeholder,omitempty"` - DefaultValue *string `json:"default_value,omitempty"` - Required *bool `json:"required,omitempty"` -} - -func (o *RunbooksElementInputEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} - -func (o *RunbooksElementInputEntity) GetPlaceholder() *string { - if o == nil { - return nil - } - return o.Placeholder -} - -func (o *RunbooksElementInputEntity) GetDefaultValue() *string { - if o == nil { - return nil - } - return o.DefaultValue -} - -func (o *RunbooksElementInputEntity) GetRequired() *bool { - if o == nil { - return nil - } - return o.Required -} diff --git a/internal/sdk/models/shared/runbookselementmarkdownentity.go b/internal/sdk/models/shared/runbookselementmarkdownentity.go deleted file mode 100644 index d627fed..0000000 --- a/internal/sdk/models/shared/runbookselementmarkdownentity.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksElementMarkdownEntity struct { - Text *string `json:"text,omitempty"` -} - -func (o *RunbooksElementMarkdownEntity) GetText() *string { - if o == nil { - return nil - } - return o.Text -} diff --git a/internal/sdk/models/shared/runbookselementtextareaentity.go b/internal/sdk/models/shared/runbookselementtextareaentity.go deleted file mode 100644 index 8caec79..0000000 --- a/internal/sdk/models/shared/runbookselementtextareaentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksElementTextareaEntity struct { - Label *string `json:"label,omitempty"` - Placeholder *string `json:"placeholder,omitempty"` - DefaultValue *string `json:"default_value,omitempty"` -} - -func (o *RunbooksElementTextareaEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} - -func (o *RunbooksElementTextareaEntity) GetPlaceholder() *string { - if o == nil { - return nil - } - return o.Placeholder -} - -func (o *RunbooksElementTextareaEntity) GetDefaultValue() *string { - if o == nil { - return nil - } - return o.DefaultValue -} diff --git a/internal/sdk/models/shared/runbooksexecutionentity.go b/internal/sdk/models/shared/runbooksexecutionentity.go deleted file mode 100644 index 2fe15b3..0000000 --- a/internal/sdk/models/shared/runbooksexecutionentity.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// RunbooksExecutionEntity - Runbooks_ExecutionEntity model -type RunbooksExecutionEntity struct { - ID *string `json:"id,omitempty"` - Status *string `json:"status,omitempty"` - StatusReason *string `json:"status_reason,omitempty"` - StatusReasonMessage *string `json:"status_reason_message,omitempty"` - HasBeenRerun *bool `json:"has_been_rerun,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - CreatedBy *string `json:"created_by,omitempty"` - Runbook *SlimRunbookEntity `json:"runbook,omitempty"` - Steps *RunbooksExecutionStepEntity `json:"steps,omitempty"` - ExecutedFor *RunbooksExecutionEntityExecutedForEntity `json:"executed_for,omitempty"` -} - -func (r RunbooksExecutionEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) -} - -func (r *RunbooksExecutionEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { - return err - } - return nil -} - -func (o *RunbooksExecutionEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *RunbooksExecutionEntity) GetStatus() *string { - if o == nil { - return nil - } - return o.Status -} - -func (o *RunbooksExecutionEntity) GetStatusReason() *string { - if o == nil { - return nil - } - return o.StatusReason -} - -func (o *RunbooksExecutionEntity) GetStatusReasonMessage() *string { - if o == nil { - return nil - } - return o.StatusReasonMessage -} - -func (o *RunbooksExecutionEntity) GetHasBeenRerun() *bool { - if o == nil { - return nil - } - return o.HasBeenRerun -} - -func (o *RunbooksExecutionEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *RunbooksExecutionEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *RunbooksExecutionEntity) GetCreatedBy() *string { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *RunbooksExecutionEntity) GetRunbook() *SlimRunbookEntity { - if o == nil { - return nil - } - return o.Runbook -} - -func (o *RunbooksExecutionEntity) GetSteps() *RunbooksExecutionStepEntity { - if o == nil { - return nil - } - return o.Steps -} - -func (o *RunbooksExecutionEntity) GetExecutedFor() *RunbooksExecutionEntityExecutedForEntity { - if o == nil { - return nil - } - return o.ExecutedFor -} diff --git a/internal/sdk/models/shared/runbooksexecutionentityexecutedforentity.go b/internal/sdk/models/shared/runbooksexecutionentityexecutedforentity.go deleted file mode 100644 index fa4e2c6..0000000 --- a/internal/sdk/models/shared/runbooksexecutionentityexecutedforentity.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksExecutionEntityExecutedForEntity struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` -} - -func (o *RunbooksExecutionEntityExecutedForEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *RunbooksExecutionEntityExecutedForEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *RunbooksExecutionEntityExecutedForEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/runbooksexecutionentitypaginated.go b/internal/sdk/models/shared/runbooksexecutionentitypaginated.go deleted file mode 100644 index 85116ff..0000000 --- a/internal/sdk/models/shared/runbooksexecutionentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// RunbooksExecutionEntityPaginated - Runbooks_ExecutionEntityPaginated model -type RunbooksExecutionEntityPaginated struct { - Data []RunbooksExecutionEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *RunbooksExecutionEntityPaginated) GetData() []RunbooksExecutionEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *RunbooksExecutionEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/runbooksexecutionstepentity.go b/internal/sdk/models/shared/runbooksexecutionstepentity.go deleted file mode 100644 index 1d5749b..0000000 --- a/internal/sdk/models/shared/runbooksexecutionstepentity.go +++ /dev/null @@ -1,173 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type Config struct { -} - -type StepElements struct { -} - -type RunbooksExecutionStepEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ActionSlug *string `json:"action_slug,omitempty"` - ActionType *string `json:"action_type,omitempty"` - IntegrationName *string `json:"integration_name,omitempty"` - IntegrationSlug *string `json:"integration_slug,omitempty"` - Automatic *bool `json:"automatic,omitempty"` - Config *Config `json:"config,omitempty"` - StepElements []StepElements `json:"step_elements,omitempty"` - Executable *bool `json:"executable,omitempty"` - Repeats *bool `json:"repeats,omitempty"` - // ISO8601 formatted duration string - RepeatsDuration *string `json:"repeats_duration,omitempty"` - RepeatsAt *time.Time `json:"repeats_at,omitempty"` - HasBeenRerun *bool `json:"has_been_rerun,omitempty"` - HasBeenRetried *bool `json:"has_been_retried,omitempty"` - Execution *RunbooksExecutionStepExecutionEntity `json:"execution,omitempty"` - Repeatable *bool `json:"repeatable,omitempty"` - Rule *RulesRuleEntity `json:"rule,omitempty"` -} - -func (r RunbooksExecutionStepEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) -} - -func (r *RunbooksExecutionStepEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { - return err - } - return nil -} - -func (o *RunbooksExecutionStepEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *RunbooksExecutionStepEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *RunbooksExecutionStepEntity) GetActionSlug() *string { - if o == nil { - return nil - } - return o.ActionSlug -} - -func (o *RunbooksExecutionStepEntity) GetActionType() *string { - if o == nil { - return nil - } - return o.ActionType -} - -func (o *RunbooksExecutionStepEntity) GetIntegrationName() *string { - if o == nil { - return nil - } - return o.IntegrationName -} - -func (o *RunbooksExecutionStepEntity) GetIntegrationSlug() *string { - if o == nil { - return nil - } - return o.IntegrationSlug -} - -func (o *RunbooksExecutionStepEntity) GetAutomatic() *bool { - if o == nil { - return nil - } - return o.Automatic -} - -func (o *RunbooksExecutionStepEntity) GetConfig() *Config { - if o == nil { - return nil - } - return o.Config -} - -func (o *RunbooksExecutionStepEntity) GetStepElements() []StepElements { - if o == nil { - return nil - } - return o.StepElements -} - -func (o *RunbooksExecutionStepEntity) GetExecutable() *bool { - if o == nil { - return nil - } - return o.Executable -} - -func (o *RunbooksExecutionStepEntity) GetRepeats() *bool { - if o == nil { - return nil - } - return o.Repeats -} - -func (o *RunbooksExecutionStepEntity) GetRepeatsDuration() *string { - if o == nil { - return nil - } - return o.RepeatsDuration -} - -func (o *RunbooksExecutionStepEntity) GetRepeatsAt() *time.Time { - if o == nil { - return nil - } - return o.RepeatsAt -} - -func (o *RunbooksExecutionStepEntity) GetHasBeenRerun() *bool { - if o == nil { - return nil - } - return o.HasBeenRerun -} - -func (o *RunbooksExecutionStepEntity) GetHasBeenRetried() *bool { - if o == nil { - return nil - } - return o.HasBeenRetried -} - -func (o *RunbooksExecutionStepEntity) GetExecution() *RunbooksExecutionStepExecutionEntity { - if o == nil { - return nil - } - return o.Execution -} - -func (o *RunbooksExecutionStepEntity) GetRepeatable() *bool { - if o == nil { - return nil - } - return o.Repeatable -} - -func (o *RunbooksExecutionStepEntity) GetRule() *RulesRuleEntity { - if o == nil { - return nil - } - return o.Rule -} diff --git a/internal/sdk/models/shared/runbooksexecutionstepexecutionentity.go b/internal/sdk/models/shared/runbooksexecutionstepexecutionentity.go deleted file mode 100644 index 2df3706..0000000 --- a/internal/sdk/models/shared/runbooksexecutionstepexecutionentity.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type RunbooksExecutionStepExecutionEntityState string - -const ( - RunbooksExecutionStepExecutionEntityStateInitial RunbooksExecutionStepExecutionEntityState = "initial" - RunbooksExecutionStepExecutionEntityStatePending RunbooksExecutionStepExecutionEntityState = "pending" - RunbooksExecutionStepExecutionEntityStateScheduled RunbooksExecutionStepExecutionEntityState = "scheduled" - RunbooksExecutionStepExecutionEntityStateStarted RunbooksExecutionStepExecutionEntityState = "started" - RunbooksExecutionStepExecutionEntityStateDismissed RunbooksExecutionStepExecutionEntityState = "dismissed" - RunbooksExecutionStepExecutionEntityStateCompleted RunbooksExecutionStepExecutionEntityState = "completed" - RunbooksExecutionStepExecutionEntityStateErrored RunbooksExecutionStepExecutionEntityState = "errored" -) - -func (e RunbooksExecutionStepExecutionEntityState) ToPointer() *RunbooksExecutionStepExecutionEntityState { - return &e -} -func (e *RunbooksExecutionStepExecutionEntityState) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "initial": - fallthrough - case "pending": - fallthrough - case "scheduled": - fallthrough - case "started": - fallthrough - case "dismissed": - fallthrough - case "completed": - fallthrough - case "errored": - *e = RunbooksExecutionStepExecutionEntityState(v) - return nil - default: - return fmt.Errorf("invalid value for RunbooksExecutionStepExecutionEntityState: %v", v) - } -} - -type RunbooksExecutionStepExecutionEntityData struct { -} - -type RunbooksExecutionStepExecutionEntity struct { - State *RunbooksExecutionStepExecutionEntityState `json:"state,omitempty"` - Data *RunbooksExecutionStepExecutionEntityData `json:"data,omitempty"` - PerformedBy *ActorEntity `json:"performed_by,omitempty"` - PerformedAt *time.Time `json:"performed_at,omitempty"` - ScheduledFor *time.Time `json:"scheduled_for,omitempty"` - Error *string `json:"error,omitempty"` - WebhookDelivery *RunbooksWebhookDeliveryEntity `json:"webhook_delivery,omitempty"` -} - -func (r RunbooksExecutionStepExecutionEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) -} - -func (r *RunbooksExecutionStepExecutionEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { - return err - } - return nil -} - -func (o *RunbooksExecutionStepExecutionEntity) GetState() *RunbooksExecutionStepExecutionEntityState { - if o == nil { - return nil - } - return o.State -} - -func (o *RunbooksExecutionStepExecutionEntity) GetData() *RunbooksExecutionStepExecutionEntityData { - if o == nil { - return nil - } - return o.Data -} - -func (o *RunbooksExecutionStepExecutionEntity) GetPerformedBy() *ActorEntity { - if o == nil { - return nil - } - return o.PerformedBy -} - -func (o *RunbooksExecutionStepExecutionEntity) GetPerformedAt() *time.Time { - if o == nil { - return nil - } - return o.PerformedAt -} - -func (o *RunbooksExecutionStepExecutionEntity) GetScheduledFor() *time.Time { - if o == nil { - return nil - } - return o.ScheduledFor -} - -func (o *RunbooksExecutionStepExecutionEntity) GetError() *string { - if o == nil { - return nil - } - return o.Error -} - -func (o *RunbooksExecutionStepExecutionEntity) GetWebhookDelivery() *RunbooksWebhookDeliveryEntity { - if o == nil { - return nil - } - return o.WebhookDelivery -} diff --git a/internal/sdk/models/shared/runbookstepentity.go b/internal/sdk/models/shared/runbookstepentity.go deleted file mode 100644 index f131190..0000000 --- a/internal/sdk/models/shared/runbookstepentity.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// RunbookStepEntityConfig - An unstructured object of key/value pairs describing the config settings for the step. -type RunbookStepEntityConfig struct { -} - -type ActionElements struct { -} - -type RunbookStepEntityStepElements struct { -} - -type RunbookStepEntity struct { - Name *string `json:"name,omitempty"` - ActionID *string `json:"action_id,omitempty"` - StepID *string `json:"step_id,omitempty"` - // An unstructured object of key/value pairs describing the config settings for the step. - Config *RunbookStepEntityConfig `json:"config,omitempty"` - // A list of action elements - ActionElements []ActionElements `json:"action_elements,omitempty"` - // A list of step elements - StepElements []RunbookStepEntityStepElements `json:"step_elements,omitempty"` - Automatic *bool `json:"automatic,omitempty"` - DelayDuration *time.Time `json:"delay_duration,omitempty"` - Action *RunbooksActionsEntity `json:"action,omitempty"` - Reruns *bool `json:"reruns,omitempty"` - Repeats *bool `json:"repeats,omitempty"` - RepeatsDuration *time.Time `json:"repeats_duration,omitempty"` - // VotesEntity model - Votes *VotesEntity `json:"votes,omitempty"` - Rule *RulesRuleEntity `json:"rule,omitempty"` -} - -func (r RunbookStepEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) -} - -func (r *RunbookStepEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { - return err - } - return nil -} - -func (o *RunbookStepEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *RunbookStepEntity) GetActionID() *string { - if o == nil { - return nil - } - return o.ActionID -} - -func (o *RunbookStepEntity) GetStepID() *string { - if o == nil { - return nil - } - return o.StepID -} - -func (o *RunbookStepEntity) GetConfig() *RunbookStepEntityConfig { - if o == nil { - return nil - } - return o.Config -} - -func (o *RunbookStepEntity) GetActionElements() []ActionElements { - if o == nil { - return nil - } - return o.ActionElements -} - -func (o *RunbookStepEntity) GetStepElements() []RunbookStepEntityStepElements { - if o == nil { - return nil - } - return o.StepElements -} - -func (o *RunbookStepEntity) GetAutomatic() *bool { - if o == nil { - return nil - } - return o.Automatic -} - -func (o *RunbookStepEntity) GetDelayDuration() *time.Time { - if o == nil { - return nil - } - return o.DelayDuration -} - -func (o *RunbookStepEntity) GetAction() *RunbooksActionsEntity { - if o == nil { - return nil - } - return o.Action -} - -func (o *RunbookStepEntity) GetReruns() *bool { - if o == nil { - return nil - } - return o.Reruns -} - -func (o *RunbookStepEntity) GetRepeats() *bool { - if o == nil { - return nil - } - return o.Repeats -} - -func (o *RunbookStepEntity) GetRepeatsDuration() *time.Time { - if o == nil { - return nil - } - return o.RepeatsDuration -} - -func (o *RunbookStepEntity) GetVotes() *VotesEntity { - if o == nil { - return nil - } - return o.Votes -} - -func (o *RunbookStepEntity) GetRule() *RulesRuleEntity { - if o == nil { - return nil - } - return o.Rule -} diff --git a/internal/sdk/models/shared/runbookswebhookdeliveryentity.go b/internal/sdk/models/shared/runbookswebhookdeliveryentity.go deleted file mode 100644 index 21faac2..0000000 --- a/internal/sdk/models/shared/runbookswebhookdeliveryentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type RunbooksWebhookDeliveryEntity struct { - Headers *string `json:"headers,omitempty"` - StatusCode *string `json:"status_code,omitempty"` -} - -func (o *RunbooksWebhookDeliveryEntity) GetHeaders() *string { - if o == nil { - return nil - } - return o.Headers -} - -func (o *RunbooksWebhookDeliveryEntity) GetStatusCode() *string { - if o == nil { - return nil - } - return o.StatusCode -} diff --git a/internal/sdk/models/shared/savedsearchentity.go b/internal/sdk/models/shared/savedsearchentity.go deleted file mode 100644 index d80e925..0000000 --- a/internal/sdk/models/shared/savedsearchentity.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// FilterValues - An unstructured key/value pair of saved values for searching -type FilterValues struct { -} - -// SavedSearchEntity model -type SavedSearchEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ResourceType *string `json:"resource_type,omitempty"` - UserID *string `json:"user_id,omitempty"` - // Whether or not this saved search is private - IsPrivate *bool `json:"is_private,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // An unstructured key/value pair of saved values for searching - FilterValues *FilterValues `json:"filter_values,omitempty"` -} - -func (s SavedSearchEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *SavedSearchEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *SavedSearchEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *SavedSearchEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *SavedSearchEntity) GetResourceType() *string { - if o == nil { - return nil - } - return o.ResourceType -} - -func (o *SavedSearchEntity) GetUserID() *string { - if o == nil { - return nil - } - return o.UserID -} - -func (o *SavedSearchEntity) GetIsPrivate() *bool { - if o == nil { - return nil - } - return o.IsPrivate -} - -func (o *SavedSearchEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *SavedSearchEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *SavedSearchEntity) GetFilterValues() *FilterValues { - if o == nil { - return nil - } - return o.FilterValues -} diff --git a/internal/sdk/models/shared/scheduledmaintenanceentity.go b/internal/sdk/models/shared/scheduledmaintenanceentity.go deleted file mode 100644 index e61d426..0000000 --- a/internal/sdk/models/shared/scheduledmaintenanceentity.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// ScheduledMaintenanceEntity model -type ScheduledMaintenanceEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - StartsAt *time.Time `json:"starts_at,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` - // IncidentEntity model - Incident *IncidentEntity `json:"incident,omitempty"` - StatusPages []ScheduledMaintenancesStatusPageEntity `json:"status_pages,omitempty"` - Impacts []ScheduledMaintenancesImpactEntity `json:"impacts,omitempty"` - // An object of label key and values - Labels map[string]string `json:"labels,omitempty"` -} - -func (s ScheduledMaintenanceEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *ScheduledMaintenanceEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ScheduledMaintenanceEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ScheduledMaintenanceEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *ScheduledMaintenanceEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *ScheduledMaintenanceEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *ScheduledMaintenanceEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ScheduledMaintenanceEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ScheduledMaintenanceEntity) GetStartsAt() *time.Time { - if o == nil { - return nil - } - return o.StartsAt -} - -func (o *ScheduledMaintenanceEntity) GetEndsAt() *time.Time { - if o == nil { - return nil - } - return o.EndsAt -} - -func (o *ScheduledMaintenanceEntity) GetIncident() *IncidentEntity { - if o == nil { - return nil - } - return o.Incident -} - -func (o *ScheduledMaintenanceEntity) GetStatusPages() []ScheduledMaintenancesStatusPageEntity { - if o == nil { - return nil - } - return o.StatusPages -} - -func (o *ScheduledMaintenanceEntity) GetImpacts() []ScheduledMaintenancesImpactEntity { - if o == nil { - return nil - } - return o.Impacts -} - -func (o *ScheduledMaintenanceEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} diff --git a/internal/sdk/models/shared/scheduledmaintenancesimpactentity.go b/internal/sdk/models/shared/scheduledmaintenancesimpactentity.go deleted file mode 100644 index 977ed06..0000000 --- a/internal/sdk/models/shared/scheduledmaintenancesimpactentity.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ScheduledMaintenancesImpactEntity struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Impact *SuccinctEntity `json:"impact,omitempty"` - // SeverityMatrix_ConditionEntity model - Condition *SeverityMatrixConditionEntity `json:"condition,omitempty"` -} - -func (o *ScheduledMaintenancesImpactEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ScheduledMaintenancesImpactEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *ScheduledMaintenancesImpactEntity) GetImpact() *SuccinctEntity { - if o == nil { - return nil - } - return o.Impact -} - -func (o *ScheduledMaintenancesImpactEntity) GetCondition() *SeverityMatrixConditionEntity { - if o == nil { - return nil - } - return o.Condition -} diff --git a/internal/sdk/models/shared/scheduledmaintenancesstatuspageentity.go b/internal/sdk/models/shared/scheduledmaintenancesstatuspageentity.go deleted file mode 100644 index 14d2bd9..0000000 --- a/internal/sdk/models/shared/scheduledmaintenancesstatuspageentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ScheduledMaintenancesStatusPageEntity struct { - ID *string `json:"id,omitempty"` - IntegrationID *string `json:"integration_id,omitempty"` - IntegrationSlug *string `json:"integration_slug,omitempty"` - IntegrationName *string `json:"integration_name,omitempty"` -} - -func (o *ScheduledMaintenancesStatusPageEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ScheduledMaintenancesStatusPageEntity) GetIntegrationID() *string { - if o == nil { - return nil - } - return o.IntegrationID -} - -func (o *ScheduledMaintenancesStatusPageEntity) GetIntegrationSlug() *string { - if o == nil { - return nil - } - return o.IntegrationSlug -} - -func (o *ScheduledMaintenancesStatusPageEntity) GetIntegrationName() *string { - if o == nil { - return nil - } - return o.IntegrationName -} diff --git a/internal/sdk/models/shared/scheduleentity.go b/internal/sdk/models/shared/scheduleentity.go deleted file mode 100644 index 9f4f2d2..0000000 --- a/internal/sdk/models/shared/scheduleentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ScheduleEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Integration *string `json:"integration,omitempty"` - Discarded *bool `json:"discarded,omitempty"` -} - -func (o *ScheduleEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ScheduleEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *ScheduleEntity) GetIntegration() *string { - if o == nil { - return nil - } - return o.Integration -} - -func (o *ScheduleEntity) GetDiscarded() *bool { - if o == nil { - return nil - } - return o.Discarded -} diff --git a/internal/sdk/models/shared/scheduleentitypaginated.go b/internal/sdk/models/shared/scheduleentitypaginated.go deleted file mode 100644 index 3a3bb0e..0000000 --- a/internal/sdk/models/shared/scheduleentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// ScheduleEntityPaginated model -type ScheduleEntityPaginated struct { - Data []ScheduleEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *ScheduleEntityPaginated) GetData() []ScheduleEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *ScheduleEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/security.go b/internal/sdk/models/shared/security.go deleted file mode 100644 index 7775774..0000000 --- a/internal/sdk/models/shared/security.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type Security struct { - APIKey *string `security:"scheme,type=apiKey,subtype=header,name=Authorization"` -} - -func (o *Security) GetAPIKey() *string { - if o == nil { - return nil - } - return o.APIKey -} diff --git a/internal/sdk/models/shared/servicechilddependencyentity.go b/internal/sdk/models/shared/servicechilddependencyentity.go deleted file mode 100644 index 16355c2..0000000 --- a/internal/sdk/models/shared/servicechilddependencyentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type ServiceChildDependencyEntity struct { - ID *string `json:"id,omitempty"` - Notes *string `json:"notes,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // ServiceEntity model - Service *ServiceEntity `json:"service,omitempty"` - Type *string `json:"type,omitempty"` -} - -func (s ServiceChildDependencyEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *ServiceChildDependencyEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ServiceChildDependencyEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ServiceChildDependencyEntity) GetNotes() *string { - if o == nil { - return nil - } - return o.Notes -} - -func (o *ServiceChildDependencyEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ServiceChildDependencyEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ServiceChildDependencyEntity) GetService() *ServiceEntity { - if o == nil { - return nil - } - return o.Service -} - -func (o *ServiceChildDependencyEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} diff --git a/internal/sdk/models/shared/servicedependencyentity.go b/internal/sdk/models/shared/servicedependencyentity.go deleted file mode 100644 index e565a94..0000000 --- a/internal/sdk/models/shared/servicedependencyentity.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// ServiceDependencyEntity model -type ServiceDependencyEntity struct { - ID *string `json:"id,omitempty"` - Notes *string `json:"notes,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // ServiceEntity model - Service *ServiceEntity `json:"service,omitempty"` - // ServiceEntity model - ConnectedService *ServiceEntity `json:"connected_service,omitempty"` -} - -func (s ServiceDependencyEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *ServiceDependencyEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ServiceDependencyEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ServiceDependencyEntity) GetNotes() *string { - if o == nil { - return nil - } - return o.Notes -} - -func (o *ServiceDependencyEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ServiceDependencyEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ServiceDependencyEntity) GetService() *ServiceEntity { - if o == nil { - return nil - } - return o.Service -} - -func (o *ServiceDependencyEntity) GetConnectedService() *ServiceEntity { - if o == nil { - return nil - } - return o.ConnectedService -} diff --git a/internal/sdk/models/shared/serviceentity.go b/internal/sdk/models/shared/serviceentity.go deleted file mode 100644 index 49e9de7..0000000 --- a/internal/sdk/models/shared/serviceentity.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// ManagedBySettings - Indicates the settings of the catalog that manages this service -type ManagedBySettings struct { -} - -// ServiceEntity model -type ServiceEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Slug *string `json:"slug,omitempty"` - ServiceTier *int `json:"service_tier,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - AllowedParams []string `json:"allowed_params,omitempty"` - // An object of label key and values - Labels map[string]string `json:"labels,omitempty"` - // List of active incident guids - ActiveIncidents []string `json:"active_incidents,omitempty"` - AlertOnAdd *bool `json:"alert_on_add,omitempty"` - AutoAddRespondingTeam *bool `json:"auto_add_responding_team,omitempty"` - // List of checklists associated with a service - Checklists []ChecklistTemplateEntity `json:"checklists,omitempty"` - CompletedChecks *int `json:"completed_checks,omitempty"` - // Information about known linkages to representations of services outside of FireHydrant. - ExternalResources []ExternalResourceEntity `json:"external_resources,omitempty"` - // List of functionalities attached to the service - Functionalities []FunctionalityEntity `json:"functionalities,omitempty"` - LastImport *ImportsImportableResourceEntity `json:"last_import,omitempty"` - // List of links attached to this service. - Links []LinksEntity `json:"links,omitempty"` - // If set, this field indicates that the service is managed by an integration and thus cannot be set manually - ManagedBy *string `json:"managed_by,omitempty"` - // Indicates the settings of the catalog that manages this service - ManagedBySettings *ManagedBySettings `json:"managed_by_settings,omitempty"` - // TeamEntity model - Owner *TeamEntity `json:"owner,omitempty"` - ServiceChecklistUpdatedAt *time.Time `json:"service_checklist_updated_at,omitempty"` - // List of teams attached to the service - Teams []TeamEntity `json:"teams,omitempty"` - UpdatedBy *AuthorEntity `json:"updated_by,omitempty"` -} - -func (s ServiceEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *ServiceEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ServiceEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ServiceEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *ServiceEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *ServiceEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *ServiceEntity) GetServiceTier() *int { - if o == nil { - return nil - } - return o.ServiceTier -} - -func (o *ServiceEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ServiceEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ServiceEntity) GetAllowedParams() []string { - if o == nil { - return nil - } - return o.AllowedParams -} - -func (o *ServiceEntity) GetLabels() map[string]string { - if o == nil { - return nil - } - return o.Labels -} - -func (o *ServiceEntity) GetActiveIncidents() []string { - if o == nil { - return nil - } - return o.ActiveIncidents -} - -func (o *ServiceEntity) GetAlertOnAdd() *bool { - if o == nil { - return nil - } - return o.AlertOnAdd -} - -func (o *ServiceEntity) GetAutoAddRespondingTeam() *bool { - if o == nil { - return nil - } - return o.AutoAddRespondingTeam -} - -func (o *ServiceEntity) GetChecklists() []ChecklistTemplateEntity { - if o == nil { - return nil - } - return o.Checklists -} - -func (o *ServiceEntity) GetCompletedChecks() *int { - if o == nil { - return nil - } - return o.CompletedChecks -} - -func (o *ServiceEntity) GetExternalResources() []ExternalResourceEntity { - if o == nil { - return nil - } - return o.ExternalResources -} - -func (o *ServiceEntity) GetFunctionalities() []FunctionalityEntity { - if o == nil { - return nil - } - return o.Functionalities -} - -func (o *ServiceEntity) GetLastImport() *ImportsImportableResourceEntity { - if o == nil { - return nil - } - return o.LastImport -} - -func (o *ServiceEntity) GetLinks() []LinksEntity { - if o == nil { - return nil - } - return o.Links -} - -func (o *ServiceEntity) GetManagedBy() *string { - if o == nil { - return nil - } - return o.ManagedBy -} - -func (o *ServiceEntity) GetManagedBySettings() *ManagedBySettings { - if o == nil { - return nil - } - return o.ManagedBySettings -} - -func (o *ServiceEntity) GetOwner() *TeamEntity { - if o == nil { - return nil - } - return o.Owner -} - -func (o *ServiceEntity) GetServiceChecklistUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.ServiceChecklistUpdatedAt -} - -func (o *ServiceEntity) GetTeams() []TeamEntity { - if o == nil { - return nil - } - return o.Teams -} - -func (o *ServiceEntity) GetUpdatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.UpdatedBy -} diff --git a/internal/sdk/models/shared/serviceentitypaginated.go b/internal/sdk/models/shared/serviceentitypaginated.go deleted file mode 100644 index 3a42367..0000000 --- a/internal/sdk/models/shared/serviceentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// ServiceEntityPaginated model -type ServiceEntityPaginated struct { - Data []ServiceEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *ServiceEntityPaginated) GetData() []ServiceEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *ServiceEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/servicelinkentity.go b/internal/sdk/models/shared/servicelinkentity.go deleted file mode 100644 index 73b22ab..0000000 --- a/internal/sdk/models/shared/servicelinkentity.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// ServiceLinkEntity model -type ServiceLinkEntity struct { - StatusCode *int `json:"status_code,omitempty"` - // ServiceEntity model - Service *ServiceEntity `json:"service,omitempty"` -} - -func (o *ServiceLinkEntity) GetStatusCode() *int { - if o == nil { - return nil - } - return o.StatusCode -} - -func (o *ServiceLinkEntity) GetService() *ServiceEntity { - if o == nil { - return nil - } - return o.Service -} diff --git a/internal/sdk/models/shared/serviceparentdependencyentity.go b/internal/sdk/models/shared/serviceparentdependencyentity.go deleted file mode 100644 index 52385a7..0000000 --- a/internal/sdk/models/shared/serviceparentdependencyentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type ServiceParentDependencyEntity struct { - ID *string `json:"id,omitempty"` - Notes *string `json:"notes,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // ServiceEntity model - Service *ServiceEntity `json:"service,omitempty"` - Type *string `json:"type,omitempty"` -} - -func (s ServiceParentDependencyEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *ServiceParentDependencyEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *ServiceParentDependencyEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ServiceParentDependencyEntity) GetNotes() *string { - if o == nil { - return nil - } - return o.Notes -} - -func (o *ServiceParentDependencyEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *ServiceParentDependencyEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *ServiceParentDependencyEntity) GetService() *ServiceEntity { - if o == nil { - return nil - } - return o.Service -} - -func (o *ServiceParentDependencyEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} diff --git a/internal/sdk/models/shared/servicewithalldependenciesentity.go b/internal/sdk/models/shared/servicewithalldependenciesentity.go deleted file mode 100644 index d551a06..0000000 --- a/internal/sdk/models/shared/servicewithalldependenciesentity.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type ServiceDependencies struct { -} - -// ServiceWithAllDependenciesEntity model -type ServiceWithAllDependenciesEntity struct { - // Services that depend on this service - ChildServiceDependencies []ServiceChildDependencyEntity `json:"child_service_dependencies,omitempty"` - // Services that this service is dependent on - ParentServiceDependencies []ServiceParentDependencyEntity `json:"parent_service_dependencies,omitempty"` - // All dependencies. Can be one of: ServiceChildDependencyEntity, ServiceParentDependencyEntity - ServiceDependencies []ServiceDependencies `json:"service_dependencies,omitempty"` -} - -func (o *ServiceWithAllDependenciesEntity) GetChildServiceDependencies() []ServiceChildDependencyEntity { - if o == nil { - return nil - } - return o.ChildServiceDependencies -} - -func (o *ServiceWithAllDependenciesEntity) GetParentServiceDependencies() []ServiceParentDependencyEntity { - if o == nil { - return nil - } - return o.ParentServiceDependencies -} - -func (o *ServiceWithAllDependenciesEntity) GetServiceDependencies() []ServiceDependencies { - if o == nil { - return nil - } - return o.ServiceDependencies -} diff --git a/internal/sdk/models/shared/severityentity.go b/internal/sdk/models/shared/severityentity.go deleted file mode 100644 index 76f24f0..0000000 --- a/internal/sdk/models/shared/severityentity.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// SeverityEntity model -type SeverityEntity struct { - Slug *string `json:"slug,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - Position *int `json:"position,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - SystemRecord *bool `json:"system_record,omitempty"` - Color *string `json:"color,omitempty"` -} - -func (s SeverityEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *SeverityEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *SeverityEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *SeverityEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *SeverityEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *SeverityEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *SeverityEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *SeverityEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *SeverityEntity) GetSystemRecord() *bool { - if o == nil { - return nil - } - return o.SystemRecord -} - -func (o *SeverityEntity) GetColor() *string { - if o == nil { - return nil - } - return o.Color -} diff --git a/internal/sdk/models/shared/severityentitypaginated.go b/internal/sdk/models/shared/severityentitypaginated.go deleted file mode 100644 index f5572b3..0000000 --- a/internal/sdk/models/shared/severityentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// SeverityEntityPaginated model -type SeverityEntityPaginated struct { - Data []SeverityEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *SeverityEntityPaginated) GetData() []SeverityEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *SeverityEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/severitymatrixconditionentity.go b/internal/sdk/models/shared/severitymatrixconditionentity.go deleted file mode 100644 index de1a32e..0000000 --- a/internal/sdk/models/shared/severitymatrixconditionentity.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// SeverityMatrixConditionEntity - SeverityMatrix_ConditionEntity model -type SeverityMatrixConditionEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - // Position is used to determine ordering of conditions in API responses and dropdowns. The condition with the lowest position (typically 0) will be considered the Default Condition - Position *int `json:"position,omitempty"` -} - -func (o *SeverityMatrixConditionEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *SeverityMatrixConditionEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *SeverityMatrixConditionEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/severitymatriximpactentity.go b/internal/sdk/models/shared/severitymatriximpactentity.go deleted file mode 100644 index 4fe7d39..0000000 --- a/internal/sdk/models/shared/severitymatriximpactentity.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// SeverityMatrixImpactEntity - SeverityMatrix_ImpactEntity model -type SeverityMatrixImpactEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - AffectsID *string `json:"affects_id,omitempty"` - Position *int `json:"position,omitempty"` -} - -func (o *SeverityMatrixImpactEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *SeverityMatrixImpactEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *SeverityMatrixImpactEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *SeverityMatrixImpactEntity) GetAffectsID() *string { - if o == nil { - return nil - } - return o.AffectsID -} - -func (o *SeverityMatrixImpactEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} diff --git a/internal/sdk/models/shared/severitymatrixitementity.go b/internal/sdk/models/shared/severitymatrixitementity.go deleted file mode 100644 index 065b96d..0000000 --- a/internal/sdk/models/shared/severitymatrixitementity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type SeverityMatrixItemEntity struct { - Severity *string `json:"severity,omitempty"` - ConditionID *string `json:"condition_id,omitempty"` - ImpactID *string `json:"impact_id,omitempty"` - ImpactType *string `json:"impact_type,omitempty"` -} - -func (o *SeverityMatrixItemEntity) GetSeverity() *string { - if o == nil { - return nil - } - return o.Severity -} - -func (o *SeverityMatrixItemEntity) GetConditionID() *string { - if o == nil { - return nil - } - return o.ConditionID -} - -func (o *SeverityMatrixItemEntity) GetImpactID() *string { - if o == nil { - return nil - } - return o.ImpactID -} - -func (o *SeverityMatrixItemEntity) GetImpactType() *string { - if o == nil { - return nil - } - return o.ImpactType -} diff --git a/internal/sdk/models/shared/severitymatrixseveritymatrixentity.go b/internal/sdk/models/shared/severitymatrixseveritymatrixentity.go deleted file mode 100644 index 5389719..0000000 --- a/internal/sdk/models/shared/severitymatrixseveritymatrixentity.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// SeverityMatrixSeverityMatrixEntity - SeverityMatrix_SeverityMatrixEntity model -type SeverityMatrixSeverityMatrixEntity struct { - Matrix []SeverityMatrixItemEntity `json:"matrix,omitempty"` - Impacts []SeverityMatrixImpactEntity `json:"impacts,omitempty"` - Conditions []SeverityMatrixConditionEntity `json:"conditions,omitempty"` -} - -func (o *SeverityMatrixSeverityMatrixEntity) GetMatrix() []SeverityMatrixItemEntity { - if o == nil { - return nil - } - return o.Matrix -} - -func (o *SeverityMatrixSeverityMatrixEntity) GetImpacts() []SeverityMatrixImpactEntity { - if o == nil { - return nil - } - return o.Impacts -} - -func (o *SeverityMatrixSeverityMatrixEntity) GetConditions() []SeverityMatrixConditionEntity { - if o == nil { - return nil - } - return o.Conditions -} diff --git a/internal/sdk/models/shared/signalsapiingestkeyentity.go b/internal/sdk/models/shared/signalsapiingestkeyentity.go deleted file mode 100644 index bebe18c..0000000 --- a/internal/sdk/models/shared/signalsapiingestkeyentity.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// SignalsAPIIngestKeyEntity - Signals_API_IngestKeyEntity model -type SignalsAPIIngestKeyEntity struct { - URL *string `json:"url,omitempty"` -} - -func (o *SignalsAPIIngestKeyEntity) GetURL() *string { - if o == nil { - return nil - } - return o.URL -} diff --git a/internal/sdk/models/shared/signalsapiruleentity.go b/internal/sdk/models/shared/signalsapiruleentity.go deleted file mode 100644 index 7df66cf..0000000 --- a/internal/sdk/models/shared/signalsapiruleentity.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type SignalsAPIRuleEntityNotificationPriorityOverride string - -const ( - SignalsAPIRuleEntityNotificationPriorityOverrideHigh SignalsAPIRuleEntityNotificationPriorityOverride = "HIGH" - SignalsAPIRuleEntityNotificationPriorityOverrideMedium SignalsAPIRuleEntityNotificationPriorityOverride = "MEDIUM" - SignalsAPIRuleEntityNotificationPriorityOverrideLow SignalsAPIRuleEntityNotificationPriorityOverride = "LOW" -) - -func (e SignalsAPIRuleEntityNotificationPriorityOverride) ToPointer() *SignalsAPIRuleEntityNotificationPriorityOverride { - return &e -} -func (e *SignalsAPIRuleEntityNotificationPriorityOverride) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "HIGH": - fallthrough - case "MEDIUM": - fallthrough - case "LOW": - *e = SignalsAPIRuleEntityNotificationPriorityOverride(v) - return nil - default: - return fmt.Errorf("invalid value for SignalsAPIRuleEntityNotificationPriorityOverride: %v", v) - } -} - -type SignalsAPIRuleEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Expression *string `json:"expression,omitempty"` - TeamID *string `json:"team_id,omitempty"` - Target *SignalsAPITargetEntity `json:"target,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - IncidentType *SuccinctEntity `json:"incident_type,omitempty"` - NotificationPriorityOverride *SignalsAPIRuleEntityNotificationPriorityOverride `json:"notification_priority_override,omitempty"` -} - -func (s SignalsAPIRuleEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *SignalsAPIRuleEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *SignalsAPIRuleEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *SignalsAPIRuleEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *SignalsAPIRuleEntity) GetExpression() *string { - if o == nil { - return nil - } - return o.Expression -} - -func (o *SignalsAPIRuleEntity) GetTeamID() *string { - if o == nil { - return nil - } - return o.TeamID -} - -func (o *SignalsAPIRuleEntity) GetTarget() *SignalsAPITargetEntity { - if o == nil { - return nil - } - return o.Target -} - -func (o *SignalsAPIRuleEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *SignalsAPIRuleEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *SignalsAPIRuleEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *SignalsAPIRuleEntity) GetIncidentType() *SuccinctEntity { - if o == nil { - return nil - } - return o.IncidentType -} - -func (o *SignalsAPIRuleEntity) GetNotificationPriorityOverride() *SignalsAPIRuleEntityNotificationPriorityOverride { - if o == nil { - return nil - } - return o.NotificationPriorityOverride -} diff --git a/internal/sdk/models/shared/signalsapitargetentity.go b/internal/sdk/models/shared/signalsapitargetentity.go deleted file mode 100644 index a6f4563..0000000 --- a/internal/sdk/models/shared/signalsapitargetentity.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type SignalsAPITargetEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - IsPageable *bool `json:"is_pageable,omitempty"` -} - -func (o *SignalsAPITargetEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *SignalsAPITargetEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *SignalsAPITargetEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *SignalsAPITargetEntity) GetIsPageable() *bool { - if o == nil { - return nil - } - return o.IsPageable -} diff --git a/internal/sdk/models/shared/slimrunbookentity.go b/internal/sdk/models/shared/slimrunbookentity.go deleted file mode 100644 index 7fc8c0f..0000000 --- a/internal/sdk/models/shared/slimrunbookentity.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type SlimRunbookEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - AttachmentRule *RulesRuleEntity `json:"attachment_rule,omitempty"` - // TeamEntity model - Owner *TeamEntity `json:"owner,omitempty"` - // categories the runbook applies to - Categories *string `json:"categories,omitempty"` -} - -func (s SlimRunbookEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *SlimRunbookEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *SlimRunbookEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *SlimRunbookEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *SlimRunbookEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *SlimRunbookEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *SlimRunbookEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *SlimRunbookEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *SlimRunbookEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *SlimRunbookEntity) GetAttachmentRule() *RulesRuleEntity { - if o == nil { - return nil - } - return o.AttachmentRule -} - -func (o *SlimRunbookEntity) GetOwner() *TeamEntity { - if o == nil { - return nil - } - return o.Owner -} - -func (o *SlimRunbookEntity) GetCategories() *string { - if o == nil { - return nil - } - return o.Categories -} diff --git a/internal/sdk/models/shared/statusupdatetemplateentity.go b/internal/sdk/models/shared/statusupdatetemplateentity.go deleted file mode 100644 index b57153b..0000000 --- a/internal/sdk/models/shared/statusupdatetemplateentity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// StatusUpdateTemplateEntity model -type StatusUpdateTemplateEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - DiscardedAt *time.Time `json:"discarded_at,omitempty"` -} - -func (s StatusUpdateTemplateEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *StatusUpdateTemplateEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - -func (o *StatusUpdateTemplateEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *StatusUpdateTemplateEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *StatusUpdateTemplateEntity) GetBody() *string { - if o == nil { - return nil - } - return o.Body -} - -func (o *StatusUpdateTemplateEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *StatusUpdateTemplateEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *StatusUpdateTemplateEntity) GetDiscardedAt() *time.Time { - if o == nil { - return nil - } - return o.DiscardedAt -} diff --git a/internal/sdk/models/shared/succinctentity.go b/internal/sdk/models/shared/succinctentity.go deleted file mode 100644 index 06d9e2e..0000000 --- a/internal/sdk/models/shared/succinctentity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type SuccinctEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` -} - -func (o *SuccinctEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *SuccinctEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/tagentity.go b/internal/sdk/models/shared/tagentity.go deleted file mode 100644 index 95fc981..0000000 --- a/internal/sdk/models/shared/tagentity.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// TagEntity model -type TagEntity struct { - Name *string `json:"name,omitempty"` -} - -func (o *TagEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/internal/sdk/models/shared/tagentitypaginated.go b/internal/sdk/models/shared/tagentitypaginated.go deleted file mode 100644 index fef6347..0000000 --- a/internal/sdk/models/shared/tagentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// TagEntityPaginated model -type TagEntityPaginated struct { - Data []TagEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *TagEntityPaginated) GetData() []TagEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *TagEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/taskentity.go b/internal/sdk/models/shared/taskentity.go deleted file mode 100644 index 83dcef1..0000000 --- a/internal/sdk/models/shared/taskentity.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// TaskEntity model -type TaskEntity struct { - ID *string `json:"id,omitempty"` - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - State *string `json:"state,omitempty"` - Assignee *AuthorEntity `json:"assignee,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - DueAt *time.Time `json:"due_at,omitempty"` -} - -func (t TaskEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(t, "", false) -} - -func (t *TaskEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { - return err - } - return nil -} - -func (o *TaskEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *TaskEntity) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *TaskEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *TaskEntity) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *TaskEntity) GetAssignee() *AuthorEntity { - if o == nil { - return nil - } - return o.Assignee -} - -func (o *TaskEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *TaskEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *TaskEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *TaskEntity) GetDueAt() *time.Time { - if o == nil { - return nil - } - return o.DueAt -} diff --git a/internal/sdk/models/shared/taskentitypaginated.go b/internal/sdk/models/shared/taskentitypaginated.go deleted file mode 100644 index ec8c140..0000000 --- a/internal/sdk/models/shared/taskentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// TaskEntityPaginated model -type TaskEntityPaginated struct { - Data []TaskEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *TaskEntityPaginated) GetData() []TaskEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *TaskEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/tasklistentity.go b/internal/sdk/models/shared/tasklistentity.go deleted file mode 100644 index 6e4c30d..0000000 --- a/internal/sdk/models/shared/tasklistentity.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// TaskListEntity model -type TaskListEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - TaskListItems *TaskListItemEntity `json:"task_list_items,omitempty"` -} - -func (t TaskListEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(t, "", false) -} - -func (t *TaskListEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { - return err - } - return nil -} - -func (o *TaskListEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *TaskListEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *TaskListEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *TaskListEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *TaskListEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *TaskListEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *TaskListEntity) GetTaskListItems() *TaskListItemEntity { - if o == nil { - return nil - } - return o.TaskListItems -} diff --git a/internal/sdk/models/shared/tasklistitementity.go b/internal/sdk/models/shared/tasklistitementity.go deleted file mode 100644 index ced7dff..0000000 --- a/internal/sdk/models/shared/tasklistitementity.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type TaskListItemEntity struct { - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` -} - -func (o *TaskListItemEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *TaskListItemEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} diff --git a/internal/sdk/models/shared/teamentity.go b/internal/sdk/models/shared/teamentity.go deleted file mode 100644 index 5eaaea3..0000000 --- a/internal/sdk/models/shared/teamentity.go +++ /dev/null @@ -1,159 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// TeamEntity model -type TeamEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Slug *string `json:"slug,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - SignalsIcalURL *string `json:"signals_ical_url,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - SlackChannel *IntegrationsSlackSlackChannelEntity `json:"slack_channel,omitempty"` - MsTeamsChannel *IntegrationsMicrosoftTeamsV2ChannelEntity `json:"ms_teams_channel,omitempty"` - Memberships []MembershipEntity `json:"memberships,omitempty"` - OwnedFunctionalities []FunctionalityEntity `json:"owned_functionalities,omitempty"` - OwnedServices []ServiceEntity `json:"owned_services,omitempty"` - OwnedRunbooks []SlimRunbookEntity `json:"owned_runbooks,omitempty"` - RespondingServices []ServiceEntity `json:"responding_services,omitempty"` - Services []ServiceEntity `json:"services,omitempty"` - Functionalities []FunctionalityEntity `json:"functionalities,omitempty"` -} - -func (t TeamEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(t, "", false) -} - -func (t *TeamEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { - return err - } - return nil -} - -func (o *TeamEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *TeamEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *TeamEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *TeamEntity) GetSlug() *string { - if o == nil { - return nil - } - return o.Slug -} - -func (o *TeamEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *TeamEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *TeamEntity) GetSignalsIcalURL() *string { - if o == nil { - return nil - } - return o.SignalsIcalURL -} - -func (o *TeamEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *TeamEntity) GetSlackChannel() *IntegrationsSlackSlackChannelEntity { - if o == nil { - return nil - } - return o.SlackChannel -} - -func (o *TeamEntity) GetMsTeamsChannel() *IntegrationsMicrosoftTeamsV2ChannelEntity { - if o == nil { - return nil - } - return o.MsTeamsChannel -} - -func (o *TeamEntity) GetMemberships() []MembershipEntity { - if o == nil { - return nil - } - return o.Memberships -} - -func (o *TeamEntity) GetOwnedFunctionalities() []FunctionalityEntity { - if o == nil { - return nil - } - return o.OwnedFunctionalities -} - -func (o *TeamEntity) GetOwnedServices() []ServiceEntity { - if o == nil { - return nil - } - return o.OwnedServices -} - -func (o *TeamEntity) GetOwnedRunbooks() []SlimRunbookEntity { - if o == nil { - return nil - } - return o.OwnedRunbooks -} - -func (o *TeamEntity) GetRespondingServices() []ServiceEntity { - if o == nil { - return nil - } - return o.RespondingServices -} - -func (o *TeamEntity) GetServices() []ServiceEntity { - if o == nil { - return nil - } - return o.Services -} - -func (o *TeamEntity) GetFunctionalities() []FunctionalityEntity { - if o == nil { - return nil - } - return o.Functionalities -} diff --git a/internal/sdk/models/shared/teamentitypaginated.go b/internal/sdk/models/shared/teamentitypaginated.go deleted file mode 100644 index 334296d..0000000 --- a/internal/sdk/models/shared/teamentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// TeamEntityPaginated model -type TeamEntityPaginated struct { - Data []TeamEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *TeamEntityPaginated) GetData() []TeamEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *TeamEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/ticketingfieldmapsmappablefieldentity.go b/internal/sdk/models/shared/ticketingfieldmapsmappablefieldentity.go deleted file mode 100644 index 6de52e6..0000000 --- a/internal/sdk/models/shared/ticketingfieldmapsmappablefieldentity.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// TicketingFieldMapsMappableFieldEntity - Ticketing_FieldMaps_MappableFieldEntity model -type TicketingFieldMapsMappableFieldEntity struct { - // The ID of the field - Value *string `json:"value,omitempty"` - // The human-readable name of the field - Label *string `json:"label,omitempty"` - // The allowed type of the field - Type *string `json:"type,omitempty"` - // The allowed values of the field - AllowedValues *string `json:"allowed_values,omitempty"` - // If the field is required to be mapped - Required *string `json:"required,omitempty"` -} - -func (o *TicketingFieldMapsMappableFieldEntity) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} - -func (o *TicketingFieldMapsMappableFieldEntity) GetLabel() *string { - if o == nil { - return nil - } - return o.Label -} - -func (o *TicketingFieldMapsMappableFieldEntity) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *TicketingFieldMapsMappableFieldEntity) GetAllowedValues() *string { - if o == nil { - return nil - } - return o.AllowedValues -} - -func (o *TicketingFieldMapsMappableFieldEntity) GetRequired() *string { - if o == nil { - return nil - } - return o.Required -} diff --git a/internal/sdk/models/shared/ticketingpriorityentity.go b/internal/sdk/models/shared/ticketingpriorityentity.go deleted file mode 100644 index a299c87..0000000 --- a/internal/sdk/models/shared/ticketingpriorityentity.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// TicketingPriorityEntity - Ticketing_PriorityEntity model -type TicketingPriorityEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Position *int `json:"position,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` -} - -func (t TicketingPriorityEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(t, "", false) -} - -func (t *TicketingPriorityEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { - return err - } - return nil -} - -func (o *TicketingPriorityEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *TicketingPriorityEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *TicketingPriorityEntity) GetPosition() *int { - if o == nil { - return nil - } - return o.Position -} - -func (o *TicketingPriorityEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *TicketingPriorityEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} diff --git a/internal/sdk/models/shared/ticketingprojectconfigentity.go b/internal/sdk/models/shared/ticketingprojectconfigentity.go deleted file mode 100644 index a2b216e..0000000 --- a/internal/sdk/models/shared/ticketingprojectconfigentity.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// TicketingProjectConfigEntityDetails - A config object containing details about the project config. Can be one of: Ticketing::JiraCloud::ProjectConfigEntity, Ticketing::JiraOnprem::ProjectConfigEntity, or Ticketing::Shortcut::ProjectConfigEntity -type TicketingProjectConfigEntityDetails struct { -} - -// TicketingProjectConfigEntity - Ticketing_ProjectConfigEntity model -type TicketingProjectConfigEntity struct { - ID *string `json:"id,omitempty"` - ConnectionID *string `json:"connection_id,omitempty"` - ConnectionType *string `json:"connection_type,omitempty"` - TicketingProjectID *string `json:"ticketing_project_id,omitempty"` - TicketingProjectName *string `json:"ticketing_project_name,omitempty"` - // A config object containing details about the project config. Can be one of: Ticketing::JiraCloud::ProjectConfigEntity, Ticketing::JiraOnprem::ProjectConfigEntity, or Ticketing::Shortcut::ProjectConfigEntity - Details *TicketingProjectConfigEntityDetails `json:"details,omitempty"` -} - -func (o *TicketingProjectConfigEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *TicketingProjectConfigEntity) GetConnectionID() *string { - if o == nil { - return nil - } - return o.ConnectionID -} - -func (o *TicketingProjectConfigEntity) GetConnectionType() *string { - if o == nil { - return nil - } - return o.ConnectionType -} - -func (o *TicketingProjectConfigEntity) GetTicketingProjectID() *string { - if o == nil { - return nil - } - return o.TicketingProjectID -} - -func (o *TicketingProjectConfigEntity) GetTicketingProjectName() *string { - if o == nil { - return nil - } - return o.TicketingProjectName -} - -func (o *TicketingProjectConfigEntity) GetDetails() *TicketingProjectConfigEntityDetails { - if o == nil { - return nil - } - return o.Details -} diff --git a/internal/sdk/models/shared/ticketingprojectfieldmapbodyentity.go b/internal/sdk/models/shared/ticketingprojectfieldmapbodyentity.go deleted file mode 100644 index 4ee9c65..0000000 --- a/internal/sdk/models/shared/ticketingprojectfieldmapbodyentity.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type TicketingProjectFieldMapBodyEntityStrategy string - -const ( - TicketingProjectFieldMapBodyEntityStrategyBasic TicketingProjectFieldMapBodyEntityStrategy = "basic" - TicketingProjectFieldMapBodyEntityStrategyLogic TicketingProjectFieldMapBodyEntityStrategy = "logic" -) - -func (e TicketingProjectFieldMapBodyEntityStrategy) ToPointer() *TicketingProjectFieldMapBodyEntityStrategy { - return &e -} -func (e *TicketingProjectFieldMapBodyEntityStrategy) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "basic": - fallthrough - case "logic": - *e = TicketingProjectFieldMapBodyEntityStrategy(v) - return nil - default: - return fmt.Errorf("invalid value for TicketingProjectFieldMapBodyEntityStrategy: %v", v) - } -} - -type UserData struct { -} - -type TicketingProjectFieldMapBodyEntity struct { - Strategy *TicketingProjectFieldMapBodyEntityStrategy `json:"strategy,omitempty"` - ExternalField *string `json:"external_field,omitempty"` - ExternalValue *TicketingProjectFieldMapExternalValueEntity `json:"external_value,omitempty"` - UserData *UserData `json:"user_data,omitempty"` - Cases []TicketingProjectFieldMapCasesEntity `json:"cases,omitempty"` - Else *TicketingProjectFieldMapCasesElseEntity `json:"else,omitempty"` -} - -func (o *TicketingProjectFieldMapBodyEntity) GetStrategy() *TicketingProjectFieldMapBodyEntityStrategy { - if o == nil { - return nil - } - return o.Strategy -} - -func (o *TicketingProjectFieldMapBodyEntity) GetExternalField() *string { - if o == nil { - return nil - } - return o.ExternalField -} - -func (o *TicketingProjectFieldMapBodyEntity) GetExternalValue() *TicketingProjectFieldMapExternalValueEntity { - if o == nil { - return nil - } - return o.ExternalValue -} - -func (o *TicketingProjectFieldMapBodyEntity) GetUserData() *UserData { - if o == nil { - return nil - } - return o.UserData -} - -func (o *TicketingProjectFieldMapBodyEntity) GetCases() []TicketingProjectFieldMapCasesEntity { - if o == nil { - return nil - } - return o.Cases -} - -func (o *TicketingProjectFieldMapBodyEntity) GetElse() *TicketingProjectFieldMapCasesElseEntity { - if o == nil { - return nil - } - return o.Else -} diff --git a/internal/sdk/models/shared/ticketingprojectfieldmapcaseselseentity.go b/internal/sdk/models/shared/ticketingprojectfieldmapcaseselseentity.go deleted file mode 100644 index 845d349..0000000 --- a/internal/sdk/models/shared/ticketingprojectfieldmapcaseselseentity.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -type TicketingProjectFieldMapCasesElseEntity struct { - ExternalValue *TicketingProjectFieldMapExternalValueEntity `json:"external_value,omitempty"` -} - -func (o *TicketingProjectFieldMapCasesElseEntity) GetExternalValue() *TicketingProjectFieldMapExternalValueEntity { - if o == nil { - return nil - } - return o.ExternalValue -} diff --git a/internal/sdk/models/shared/ticketingprojectfieldmapcasesentity.go b/internal/sdk/models/shared/ticketingprojectfieldmapcasesentity.go deleted file mode 100644 index aa71386..0000000 --- a/internal/sdk/models/shared/ticketingprojectfieldmapcasesentity.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// TicketingProjectFieldMapCasesEntityLogic - An unstructured object of key/value pairs describing the logic for applying the rule. -type TicketingProjectFieldMapCasesEntityLogic struct { -} - -type TicketingProjectFieldMapCasesEntity struct { - // An unstructured object of key/value pairs describing the logic for applying the rule. - Logic *TicketingProjectFieldMapCasesEntityLogic `json:"logic,omitempty"` - ExternalValue *TicketingProjectFieldMapExternalValueEntity `json:"external_value,omitempty"` -} - -func (o *TicketingProjectFieldMapCasesEntity) GetLogic() *TicketingProjectFieldMapCasesEntityLogic { - if o == nil { - return nil - } - return o.Logic -} - -func (o *TicketingProjectFieldMapCasesEntity) GetExternalValue() *TicketingProjectFieldMapExternalValueEntity { - if o == nil { - return nil - } - return o.ExternalValue -} diff --git a/internal/sdk/models/shared/ticketingprojectfieldmapentity.go b/internal/sdk/models/shared/ticketingprojectfieldmapentity.go deleted file mode 100644 index 327cf0c..0000000 --- a/internal/sdk/models/shared/ticketingprojectfieldmapentity.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// TicketingProjectFieldMapEntity - Ticketing_ProjectFieldMapEntity model -type TicketingProjectFieldMapEntity struct { - ID *string `json:"id,omitempty"` - ConnectionID *string `json:"connection_id,omitempty"` - ConnectionType *string `json:"connection_type,omitempty"` - TicketingProjectID *string `json:"ticketing_project_id,omitempty"` - Body []TicketingProjectFieldMapBodyEntity `json:"body,omitempty"` -} - -func (o *TicketingProjectFieldMapEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *TicketingProjectFieldMapEntity) GetConnectionID() *string { - if o == nil { - return nil - } - return o.ConnectionID -} - -func (o *TicketingProjectFieldMapEntity) GetConnectionType() *string { - if o == nil { - return nil - } - return o.ConnectionType -} - -func (o *TicketingProjectFieldMapEntity) GetTicketingProjectID() *string { - if o == nil { - return nil - } - return o.TicketingProjectID -} - -func (o *TicketingProjectFieldMapEntity) GetBody() []TicketingProjectFieldMapBodyEntity { - if o == nil { - return nil - } - return o.Body -} diff --git a/internal/sdk/models/shared/ticketingprojectfieldmapexternalvalueentity.go b/internal/sdk/models/shared/ticketingprojectfieldmapexternalvalueentity.go deleted file mode 100644 index 10cbf5c..0000000 --- a/internal/sdk/models/shared/ticketingprojectfieldmapexternalvalueentity.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type TicketingProjectFieldMapExternalValueEntityType string - -const ( - TicketingProjectFieldMapExternalValueEntityTypeLiteral TicketingProjectFieldMapExternalValueEntityType = "literal" - TicketingProjectFieldMapExternalValueEntityTypeFhAttribute TicketingProjectFieldMapExternalValueEntityType = "fh-attribute" - TicketingProjectFieldMapExternalValueEntityTypeFhType TicketingProjectFieldMapExternalValueEntityType = "fh-type" -) - -func (e TicketingProjectFieldMapExternalValueEntityType) ToPointer() *TicketingProjectFieldMapExternalValueEntityType { - return &e -} -func (e *TicketingProjectFieldMapExternalValueEntityType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "literal": - fallthrough - case "fh-attribute": - fallthrough - case "fh-type": - *e = TicketingProjectFieldMapExternalValueEntityType(v) - return nil - default: - return fmt.Errorf("invalid value for TicketingProjectFieldMapExternalValueEntityType: %v", v) - } -} - -type TicketingProjectFieldMapExternalValueEntity struct { - Type *TicketingProjectFieldMapExternalValueEntityType `json:"type,omitempty"` - Value *string `json:"value,omitempty"` - Attribute *string `json:"attribute,omitempty"` - Presentation *string `json:"presentation,omitempty"` -} - -func (o *TicketingProjectFieldMapExternalValueEntity) GetType() *TicketingProjectFieldMapExternalValueEntityType { - if o == nil { - return nil - } - return o.Type -} - -func (o *TicketingProjectFieldMapExternalValueEntity) GetValue() *string { - if o == nil { - return nil - } - return o.Value -} - -func (o *TicketingProjectFieldMapExternalValueEntity) GetAttribute() *string { - if o == nil { - return nil - } - return o.Attribute -} - -func (o *TicketingProjectFieldMapExternalValueEntity) GetPresentation() *string { - if o == nil { - return nil - } - return o.Presentation -} diff --git a/internal/sdk/models/shared/ticketingprojectsprojectlistitementity.go b/internal/sdk/models/shared/ticketingprojectsprojectlistitementity.go deleted file mode 100644 index 7199966..0000000 --- a/internal/sdk/models/shared/ticketingprojectsprojectlistitementity.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// TicketingProjectsProjectListItemEntity - Ticketing_Projects_ProjectListItemEntity model -type TicketingProjectsProjectListItemEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - // Ticketing_ProjectConfigEntity model - Config *TicketingProjectConfigEntity `json:"config,omitempty"` - // Ticketing_ProjectFieldMapEntity model - FieldMap *TicketingProjectFieldMapEntity `json:"field_map,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - ConnectionSlug *string `json:"connection_slug,omitempty"` -} - -func (t TicketingProjectsProjectListItemEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(t, "", false) -} - -func (t *TicketingProjectsProjectListItemEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { - return err - } - return nil -} - -func (o *TicketingProjectsProjectListItemEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *TicketingProjectsProjectListItemEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *TicketingProjectsProjectListItemEntity) GetConfig() *TicketingProjectConfigEntity { - if o == nil { - return nil - } - return o.Config -} - -func (o *TicketingProjectsProjectListItemEntity) GetFieldMap() *TicketingProjectFieldMapEntity { - if o == nil { - return nil - } - return o.FieldMap -} - -func (o *TicketingProjectsProjectListItemEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *TicketingProjectsProjectListItemEntity) GetConnectionSlug() *string { - if o == nil { - return nil - } - return o.ConnectionSlug -} diff --git a/internal/sdk/models/shared/ticketingticketentity.go b/internal/sdk/models/shared/ticketingticketentity.go deleted file mode 100644 index d3e1c94..0000000 --- a/internal/sdk/models/shared/ticketingticketentity.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type TicketingTicketEntityState string - -const ( - TicketingTicketEntityStateOpen TicketingTicketEntityState = "open" - TicketingTicketEntityStateInProgress TicketingTicketEntityState = "in_progress" - TicketingTicketEntityStateCancelled TicketingTicketEntityState = "cancelled" - TicketingTicketEntityStateDone TicketingTicketEntityState = "done" -) - -func (e TicketingTicketEntityState) ToPointer() *TicketingTicketEntityState { - return &e -} -func (e *TicketingTicketEntityState) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "open": - fallthrough - case "in_progress": - fallthrough - case "cancelled": - fallthrough - case "done": - *e = TicketingTicketEntityState(v) - return nil - default: - return fmt.Errorf("invalid value for TicketingTicketEntityState: %v", v) - } -} - -type TicketingTicketEntityType string - -const ( - TicketingTicketEntityTypeIncident TicketingTicketEntityType = "incident" - TicketingTicketEntityTypeTask TicketingTicketEntityType = "task" - TicketingTicketEntityTypeFollowUp TicketingTicketEntityType = "follow_up" -) - -func (e TicketingTicketEntityType) ToPointer() *TicketingTicketEntityType { - return &e -} -func (e *TicketingTicketEntityType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "incident": - fallthrough - case "task": - fallthrough - case "follow_up": - *e = TicketingTicketEntityType(v) - return nil - default: - return fmt.Errorf("invalid value for TicketingTicketEntityType: %v", v) - } -} - -type TicketingTicketEntityAttachments struct { -} - -// TicketingTicketEntity - Ticketing_TicketEntity model -type TicketingTicketEntity struct { - ID *string `json:"id,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - State *TicketingTicketEntityState `json:"state,omitempty"` - Type *TicketingTicketEntityType `json:"type,omitempty"` - Assignees []AuthorEntity `json:"assignees,omitempty"` - // Ticketing_PriorityEntity model - Priority *TicketingPriorityEntity `json:"priority,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - // A list of objects attached to this item. Can be one of: LinkEntity, CustomerSupportIssueEntity, or GenericAttachmentEntity - Attachments []TicketingTicketEntityAttachments `json:"attachments,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - TagList []string `json:"tag_list,omitempty"` - // ID of incident that this ticket is related to - IncidentID *string `json:"incident_id,omitempty"` - // Name of incident that this ticket is related to - IncidentName *string `json:"incident_name,omitempty"` - // Milestone of incident that this ticket is related to - IncidentCurrentMilestone *string `json:"incident_current_milestone,omitempty"` - // ID of task that this ticket is related to - TaskID *string `json:"task_id,omitempty"` - DueAt *time.Time `json:"due_at,omitempty"` - // Attachments_LinkEntity model - Link *AttachmentsLinkEntity `json:"link,omitempty"` -} - -func (t TicketingTicketEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(t, "", false) -} - -func (t *TicketingTicketEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { - return err - } - return nil -} - -func (o *TicketingTicketEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *TicketingTicketEntity) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *TicketingTicketEntity) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *TicketingTicketEntity) GetState() *TicketingTicketEntityState { - if o == nil { - return nil - } - return o.State -} - -func (o *TicketingTicketEntity) GetType() *TicketingTicketEntityType { - if o == nil { - return nil - } - return o.Type -} - -func (o *TicketingTicketEntity) GetAssignees() []AuthorEntity { - if o == nil { - return nil - } - return o.Assignees -} - -func (o *TicketingTicketEntity) GetPriority() *TicketingPriorityEntity { - if o == nil { - return nil - } - return o.Priority -} - -func (o *TicketingTicketEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *TicketingTicketEntity) GetAttachments() []TicketingTicketEntityAttachments { - if o == nil { - return nil - } - return o.Attachments -} - -func (o *TicketingTicketEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *TicketingTicketEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *TicketingTicketEntity) GetTagList() []string { - if o == nil { - return nil - } - return o.TagList -} - -func (o *TicketingTicketEntity) GetIncidentID() *string { - if o == nil { - return nil - } - return o.IncidentID -} - -func (o *TicketingTicketEntity) GetIncidentName() *string { - if o == nil { - return nil - } - return o.IncidentName -} - -func (o *TicketingTicketEntity) GetIncidentCurrentMilestone() *string { - if o == nil { - return nil - } - return o.IncidentCurrentMilestone -} - -func (o *TicketingTicketEntity) GetTaskID() *string { - if o == nil { - return nil - } - return o.TaskID -} - -func (o *TicketingTicketEntity) GetDueAt() *time.Time { - if o == nil { - return nil - } - return o.DueAt -} - -func (o *TicketingTicketEntity) GetLink() *AttachmentsLinkEntity { - if o == nil { - return nil - } - return o.Link -} diff --git a/internal/sdk/models/shared/userentity.go b/internal/sdk/models/shared/userentity.go deleted file mode 100644 index 01ece0e..0000000 --- a/internal/sdk/models/shared/userentity.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -type UserEntity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Email *string `json:"email,omitempty"` - SlackUserID *string `json:"slack_user_id,omitempty"` - SlackLinked *bool `json:"slack_linked?,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - SignalsEnabledNotificationTypes []string `json:"signals_enabled_notification_types,omitempty"` -} - -func (u UserEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(u, "", false) -} - -func (u *UserEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { - return err - } - return nil -} - -func (o *UserEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *UserEntity) GetName() *string { - if o == nil { - return nil - } - return o.Name -} - -func (o *UserEntity) GetEmail() *string { - if o == nil { - return nil - } - return o.Email -} - -func (o *UserEntity) GetSlackUserID() *string { - if o == nil { - return nil - } - return o.SlackUserID -} - -func (o *UserEntity) GetSlackLinked() *bool { - if o == nil { - return nil - } - return o.SlackLinked -} - -func (o *UserEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *UserEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *UserEntity) GetSignalsEnabledNotificationTypes() []string { - if o == nil { - return nil - } - return o.SignalsEnabledNotificationTypes -} diff --git a/internal/sdk/models/shared/userentitypaginated.go b/internal/sdk/models/shared/userentitypaginated.go deleted file mode 100644 index b8a29ba..0000000 --- a/internal/sdk/models/shared/userentitypaginated.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// UserEntityPaginated model -type UserEntityPaginated struct { - Data []UserEntity `json:"data,omitempty"` - Pagination *PaginationEntity `json:"pagination,omitempty"` -} - -func (o *UserEntityPaginated) GetData() []UserEntity { - if o == nil { - return nil - } - return o.Data -} - -func (o *UserEntityPaginated) GetPagination() *PaginationEntity { - if o == nil { - return nil - } - return o.Pagination -} diff --git a/internal/sdk/models/shared/votesentity.go b/internal/sdk/models/shared/votesentity.go deleted file mode 100644 index d3be9fb..0000000 --- a/internal/sdk/models/shared/votesentity.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -// VotesEntity model -type VotesEntity struct { - // Whether or not the current actor has voted - Voted *bool `json:"voted,omitempty"` - // Whether or not the current actor has voted positively - Liked *bool `json:"liked,omitempty"` - // Whether or not the current actor has voted negatively - Disliked *bool `json:"disliked,omitempty"` - Likes *int `json:"likes,omitempty"` - Dislikes *int `json:"dislikes,omitempty"` -} - -func (o *VotesEntity) GetVoted() *bool { - if o == nil { - return nil - } - return o.Voted -} - -func (o *VotesEntity) GetLiked() *bool { - if o == nil { - return nil - } - return o.Liked -} - -func (o *VotesEntity) GetDisliked() *bool { - if o == nil { - return nil - } - return o.Disliked -} - -func (o *VotesEntity) GetLikes() *int { - if o == nil { - return nil - } - return o.Likes -} - -func (o *VotesEntity) GetDislikes() *int { - if o == nil { - return nil - } - return o.Dislikes -} diff --git a/internal/sdk/models/shared/webhooksentitieswebhookentity.go b/internal/sdk/models/shared/webhooksentitieswebhookentity.go deleted file mode 100644 index b7d561c..0000000 --- a/internal/sdk/models/shared/webhooksentitieswebhookentity.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "time" -) - -// WebhooksEntitiesWebhookEntity - Webhooks_Entities_WebhookEntity model -type WebhooksEntitiesWebhookEntity struct { - ID *string `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - State *string `json:"state,omitempty"` - CreatedBy *AuthorEntity `json:"created_by,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - Subscriptions *string `json:"subscriptions,omitempty"` -} - -func (w WebhooksEntitiesWebhookEntity) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(w, "", false) -} - -func (w *WebhooksEntitiesWebhookEntity) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { - return err - } - return nil -} - -func (o *WebhooksEntitiesWebhookEntity) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *WebhooksEntitiesWebhookEntity) GetURL() *string { - if o == nil { - return nil - } - return o.URL -} - -func (o *WebhooksEntitiesWebhookEntity) GetState() *string { - if o == nil { - return nil - } - return o.State -} - -func (o *WebhooksEntitiesWebhookEntity) GetCreatedBy() *AuthorEntity { - if o == nil { - return nil - } - return o.CreatedBy -} - -func (o *WebhooksEntitiesWebhookEntity) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *WebhooksEntitiesWebhookEntity) GetUpdatedAt() *time.Time { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *WebhooksEntitiesWebhookEntity) GetSubscriptions() *string { - if o == nil { - return nil - } - return o.Subscriptions -} diff --git a/internal/sdk/noauth.go b/internal/sdk/noauth.go deleted file mode 100644 index 0ea4df0..0000000 --- a/internal/sdk/noauth.go +++ /dev/null @@ -1,145 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Noauth - Operations about noauths -type Noauth struct { - sdkConfiguration sdkConfiguration -} - -func newNoauth(sdkConfig sdkConfiguration) *Noauth { - return &Noauth{ - sdkConfiguration: sdkConfig, - } -} - -// Ping -// Simple endpoint to verify your API connection is working -func (s *Noauth) Ping(ctx context.Context, opts ...operations.Option) (*operations.GetV1NoauthPingResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1NoauthPing", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/noauth/ping") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1NoauthPingResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PongEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PongEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/notes.go b/internal/sdk/notes.go deleted file mode 100644 index 971621e..0000000 --- a/internal/sdk/notes.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type Notes struct { - sdkConfiguration sdkConfiguration -} - -func newNotes(sdkConfig sdkConfiguration) *Notes { - return &Notes{ - sdkConfiguration: sdkConfig, - } -} - -// Patch - Update a note -// Updates the body of a note -func (s *Notes) Patch(ctx context.Context, request operations.PatchV1IncidentsIncidentIDNotesNoteIDRequest, opts ...operations.Option) (*operations.PatchV1IncidentsIncidentIDNotesNoteIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1IncidentsIncidentIdNotesNoteId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/notes/{note_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1IncidentsIncidentIDNotesNoteID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1IncidentsIncidentIDNotesNoteIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.EventNoteEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.EventNoteEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/nunc.go b/internal/sdk/nunc.go deleted file mode 100644 index 9f8eeb8..0000000 --- a/internal/sdk/nunc.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Nunc - Operations about nuncs -type Nunc struct { - sdkConfiguration sdkConfiguration -} - -func newNunc(sdkConfig sdkConfiguration) *Nunc { - return &Nunc{ - sdkConfiguration: sdkConfig, - } -} - -// Unsubscribe from status page updates -// Unsubscribe from status page updates -func (s *Nunc) Unsubscribe(ctx context.Context, request operations.DeleteV1NuncSubscriptionsUnsubscribeTokenRequest, opts ...operations.Option) (*operations.DeleteV1NuncSubscriptionsUnsubscribeTokenResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1NuncSubscriptionsUnsubscribeToken", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc/subscriptions/{unsubscribe_token}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1NuncSubscriptionsUnsubscribeTokenResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncNuncSubscription - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncNuncSubscription = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateSubscription - Subscribe to status page updates -// Subscribe to status page updates -func (s *Nunc) CreateSubscription(ctx context.Context, request shared.PostV1NuncSubscriptions, opts ...operations.Option) (*operations.PostV1NuncSubscriptionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1NuncSubscriptions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/nunc/subscriptions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1NuncSubscriptionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncNuncSubscription - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncNuncSubscription = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/nuncconnections.go b/internal/sdk/nuncconnections.go deleted file mode 100644 index eccf132..0000000 --- a/internal/sdk/nuncconnections.go +++ /dev/null @@ -1,1780 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// NuncConnections - Operations about nunc_connections -type NuncConnections struct { - ComponentGroups *ComponentGroups - - sdkConfiguration sdkConfiguration -} - -func newNuncConnections(sdkConfig sdkConfiguration) *NuncConnections { - return &NuncConnections{ - sdkConfiguration: sdkConfig, - ComponentGroups: newComponentGroups(sdkConfig), - } -} - -// List - Lists the FireHydrant hosted status pages -// Lists the information displayed as part of your FireHydrant hosted status pages. -func (s *NuncConnections) List(ctx context.Context, opts ...operations.Option) (*operations.GetV1NuncConnectionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1NuncConnections", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/nunc_connections") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1NuncConnectionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetSubscribers - Retrieves the list of subscribers for a status page -// Retrieves the list of subscribers for a status page. -func (s *NuncConnections) GetSubscribers(ctx context.Context, request operations.GetV1NuncConnectionsNuncConnectionIDSubscribersRequest, opts ...operations.Option) (*operations.GetV1NuncConnectionsNuncConnectionIDSubscribersResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1NuncConnectionsNuncConnectionIdSubscribers", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/subscribers", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1NuncConnectionsNuncConnectionIDSubscribersResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncEmailSubscribersEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncEmailSubscribersEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a FireHydrant hosted status page -// Delete a FireHydrant hosted status page, stopping updates of your incidents to it. -func (s *NuncConnections) Delete(ctx context.Context, request operations.DeleteV1NuncConnectionsNuncConnectionIDRequest, opts ...operations.Option) (*operations.DeleteV1NuncConnectionsNuncConnectionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1NuncConnectionsNuncConnectionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1NuncConnectionsNuncConnectionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a FireHydrant hosted status page -// Update your company's information and other components in the specified FireHydrant hosted status page. -func (s *NuncConnections) Update(ctx context.Context, request operations.PutV1NuncConnectionsNuncConnectionIDRequest, opts ...operations.Option) (*operations.PutV1NuncConnectionsNuncConnectionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1NuncConnectionsNuncConnectionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1NuncConnectionsNuncConnectionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve information about a FireHydrant hosted status page -// Retrieve the information displayed as part of your FireHydrant hosted status page. -func (s *NuncConnections) Get(ctx context.Context, request operations.GetV1NuncConnectionsNuncConnectionIDRequest, opts ...operations.Option) (*operations.GetV1NuncConnectionsNuncConnectionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1NuncConnectionsNuncConnectionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1NuncConnectionsNuncConnectionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteComponentGroup - Delete a component group displayed on a FireHydrant status page -// Delete a component group displayed on a FireHydrant status page -func (s *NuncConnections) DeleteComponentGroup(ctx context.Context, request operations.DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDRequest, opts ...operations.Option) (*operations.DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1NuncConnectionsNuncConnectionIdComponentGroupsGroupId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/component_groups/{group_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1NuncConnectionsNuncConnectionIDComponentGroupsGroupIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateLink - Update a link to be displayed on a FireHydrant status page -// Update a link to be displayed on a FireHydrant status page -func (s *NuncConnections) UpdateLink(ctx context.Context, request operations.PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest, opts ...operations.Option) (*operations.PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1NuncConnectionsNuncConnectionIdLinksLinkId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/links/{link_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1NuncConnectionsNuncConnectionIDLinksLinkID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddLink - Update a link to be displayed on a FireHydrant status page -// Add a link to be displayed on a FireHydrant status page -func (s *NuncConnections) AddLink(ctx context.Context, request operations.PostV1NuncConnectionsNuncConnectionIDLinksRequest, opts ...operations.Option) (*operations.PostV1NuncConnectionsNuncConnectionIDLinksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1NuncConnectionsNuncConnectionIdLinks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/links", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1NuncConnectionsNuncConnectionIDLinksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteImage - Delete an image attached to a FireHydrant status page -// Delete an image attached to a FireHydrant status page -func (s *NuncConnections) DeleteImage(ctx context.Context, request operations.DeleteV1NuncConnectionsNuncConnectionIDImagesTypeRequest, opts ...operations.Option) (*operations.DeleteV1NuncConnectionsNuncConnectionIDImagesTypeResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1NuncConnectionsNuncConnectionIdImagesType", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/images/{type}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1NuncConnectionsNuncConnectionIDImagesTypeResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateImage - Add or replace an image attached to a FireHydrant status page -// Add or replace an image attached to a FireHydrant status page -func (s *NuncConnections) UpdateImage(ctx context.Context, request operations.PutV1NuncConnectionsNuncConnectionIDImagesTypeRequest, opts ...operations.Option) (*operations.PutV1NuncConnectionsNuncConnectionIDImagesTypeResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1NuncConnectionsNuncConnectionIdImagesType", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/images/{type}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "multipart", `request:"mediaType=multipart/form-data"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1NuncConnectionsNuncConnectionIDImagesTypeResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Create a FireHydrant hosted status page -// Create a new FireHydrant hosted status page for customer facing statuses. -func (s *NuncConnections) Create(ctx context.Context, request operations.PostV1NuncConnectionsRequestBody, opts ...operations.Option) (*operations.PostV1NuncConnectionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1NuncConnections", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/nunc_connections") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1NuncConnectionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Unsubscribe - Unsubscribes one or more status page subscribers. -// Unsubscribes one or more status page subscribers. -func (s *NuncConnections) Unsubscribe(ctx context.Context, request operations.DeleteV1NuncConnectionsNuncConnectionIDSubscribersRequest, opts ...operations.Option) (*operations.DeleteV1NuncConnectionsNuncConnectionIDSubscribersResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1NuncConnectionsNuncConnectionIdSubscribers", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/subscribers", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1NuncConnectionsNuncConnectionIDSubscribersResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncEmailSubscribersEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncEmailSubscribersEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddSubscribers - Subscribes a comma-separated string of emails to status page updates -// Subscribes a comma-separated string of emails to status page updates -func (s *NuncConnections) AddSubscribers(ctx context.Context, request operations.PostV1NuncConnectionsNuncConnectionIDSubscribersRequest, opts ...operations.Option) (*operations.PostV1NuncConnectionsNuncConnectionIDSubscribersResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1NuncConnectionsNuncConnectionIdSubscribers", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/subscribers", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1NuncConnectionsNuncConnectionIDSubscribersResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncEmailSubscribersEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncEmailSubscribersEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// AddComponentGroup - Add a component group to be displayed on a FireHydrant status page -// Add a component group to be displayed on a FireHydrant status page -func (s *NuncConnections) AddComponentGroup(ctx context.Context, request operations.PostV1NuncConnectionsNuncConnectionIDComponentGroupsRequest, opts ...operations.Option) (*operations.PostV1NuncConnectionsNuncConnectionIDComponentGroupsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1NuncConnectionsNuncConnectionIdComponentGroups", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/component_groups", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1NuncConnectionsNuncConnectionIDComponentGroupsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.NuncConnectionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.NuncConnectionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteLink - Delete a link displayed on a FireHydrant status page -// Delete a link displayed on a FireHydrant status page -func (s *NuncConnections) DeleteLink(ctx context.Context, request operations.DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDRequest, opts ...operations.Option) (*operations.DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1NuncConnectionsNuncConnectionIdLinksLinkId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/nunc_connections/{nunc_connection_id}/links/{link_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1NuncConnectionsNuncConnectionIDLinksLinkIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/oncallschedules.go b/internal/sdk/oncallschedules.go deleted file mode 100644 index 351e513..0000000 --- a/internal/sdk/oncallschedules.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type OnCallSchedules struct { - sdkConfiguration sdkConfiguration -} - -func newOnCallSchedules(sdkConfig sdkConfiguration) *OnCallSchedules { - return &OnCallSchedules{ - sdkConfiguration: sdkConfig, - } -} - -// Create an on-call schedule -// Create a Signals on-call schedule for a team. -func (s *OnCallSchedules) Create(ctx context.Context, request operations.PostV1TeamsTeamIDOnCallSchedulesRequest, opts ...operations.Option) (*operations.PostV1TeamsTeamIDOnCallSchedulesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TeamsTeamIdOnCallSchedules", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1TeamsTeamIDOnCallSchedules", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TeamsTeamIDOnCallSchedulesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get an on-call schedule -// Get a Signals on-call schedule by ID -func (s *OnCallSchedules) Get(ctx context.Context, request operations.GetV1TeamsTeamIDOnCallSchedulesScheduleIDRequest, opts ...operations.Option) (*operations.GetV1TeamsTeamIDOnCallSchedulesScheduleIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TeamsTeamIdOnCallSchedulesScheduleId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules/{schedule_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsTeamIDOnCallSchedulesScheduleIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/ping.go b/internal/sdk/ping.go deleted file mode 100644 index 4a50335..0000000 --- a/internal/sdk/ping.go +++ /dev/null @@ -1,145 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Ping - Operations about pings -type Ping struct { - sdkConfiguration sdkConfiguration -} - -func newPing(sdkConfig sdkConfiguration) *Ping { - return &Ping{ - sdkConfiguration: sdkConfig, - } -} - -// Get - Ping -// Simple endpoint to verify your API connection is working -func (s *Ping) Get(ctx context.Context, opts ...operations.Option) (*operations.GetV1PingResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Ping", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ping") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1PingResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PongEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PongEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/postmortems.go b/internal/sdk/postmortems.go deleted file mode 100644 index a4e8901..0000000 --- a/internal/sdk/postmortems.go +++ /dev/null @@ -1,1496 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type PostMortems struct { - Reports *FirehydrantReports - ContributingFactors *ContributingFactors - - sdkConfiguration sdkConfiguration -} - -func newPostMortems(sdkConfig sdkConfiguration) *PostMortems { - return &PostMortems{ - sdkConfiguration: sdkConfig, - Reports: newFirehydrantReports(sdkConfig), - ContributingFactors: newContributingFactors(sdkConfig), - } -} - -// CreateReport - Create a report -// Create a report -func (s *PostMortems) CreateReport(ctx context.Context, request shared.PostV1PostMortemsReports, opts ...operations.Option) (*operations.PostV1PostMortemsReportsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1PostMortemsReports", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/post_mortems/reports") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1PostMortemsReportsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsPostMortemReportEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsPostMortemReportEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListReports - List all reports -// List all reports -func (s *PostMortems) ListReports(ctx context.Context, request operations.GetV1PostMortemsReportsRequest, opts ...operations.Option) (*operations.GetV1PostMortemsReportsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1PostMortemsReports", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/post_mortems/reports") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1PostMortemsReportsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsPostMortemReportEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsPostMortemReportEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetReport - Get a report -// Get a report -func (s *PostMortems) GetReport(ctx context.Context, request operations.GetV1PostMortemsReportsReportIDRequest, opts ...operations.Option) (*operations.GetV1PostMortemsReportsReportIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1PostMortemsReportsReportId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1PostMortemsReportsReportIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsPostMortemReportEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsPostMortemReportEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ReorderContributingFactor - Reorder a contributing factor -// Reorder a contributing factor -func (s *PostMortems) ReorderContributingFactor(ctx context.Context, request operations.PutV1PostMortemsReportsReportIDReasonsOrderRequest, opts ...operations.Option) (*operations.PutV1PostMortemsReportsReportIDReasonsOrderResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1PostMortemsReportsReportIdReasonsOrder", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}/reasons/order", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PutV1PostMortemsReportsReportIDReasonsOrder", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1PostMortemsReportsReportIDReasonsOrderResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsReasonEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsReasonEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateField - Update a field -// Update a field value on a post mortem report -func (s *PostMortems) UpdateField(ctx context.Context, request operations.PatchV1PostMortemsReportsReportIDFieldsFieldIDRequest, opts ...operations.Option) (*operations.PatchV1PostMortemsReportsReportIDFieldsFieldIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1PostMortemsReportsReportIdFieldsFieldId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}/fields/{field_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1PostMortemsReportsReportIDFieldsFieldID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1PostMortemsReportsReportIDFieldsFieldIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsSectionFieldEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsSectionFieldEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// PublishReport - Publish a retrospective report -// Marks an incident retrospective as published and emails all of the participants in the report the summary -func (s *PostMortems) PublishReport(ctx context.Context, request operations.PostV1PostMortemsReportsReportIDPublishRequest, opts ...operations.Option) (*operations.PostV1PostMortemsReportsReportIDPublishResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1PostMortemsReportsReportIdPublish", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}/publish", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1PostMortemsReportsReportIDPublish", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1PostMortemsReportsReportIDPublishResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsPostMortemReportEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsPostMortemReportEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateQuestions - Update incident retrospective questions -// Update the questions configured to be provided and filled out on future retrospective reports. -func (s *PostMortems) UpdateQuestions(ctx context.Context, request shared.PutV1PostMortemsQuestions, opts ...operations.Option) (*operations.PutV1PostMortemsQuestionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1PostMortemsQuestions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/post_mortems/questions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1PostMortemsQuestionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsQuestionTypeEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsQuestionTypeEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListQuestions - List incident retrospective questions -// List the questions configured to be provided and filled out on each retrospective report. -func (s *PostMortems) ListQuestions(ctx context.Context, request operations.GetV1PostMortemsQuestionsRequest, opts ...operations.Option) (*operations.GetV1PostMortemsQuestionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1PostMortemsQuestions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/post_mortems/questions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1PostMortemsQuestionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsQuestionTypeEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsQuestionTypeEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListReasons - List contributing factors -// List all contributing factors to an incident -func (s *PostMortems) ListReasons(ctx context.Context, request operations.GetV1PostMortemsReportsReportIDReasonsRequest, opts ...operations.Option) (*operations.GetV1PostMortemsReportsReportIDReasonsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1PostMortemsReportsReportIdReasons", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}/reasons", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1PostMortemsReportsReportIDReasonsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsReasonEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsReasonEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateReason - Update a contributing factor -// Update a contributing factor -func (s *PostMortems) UpdateReason(ctx context.Context, request operations.PatchV1PostMortemsReportsReportIDReasonsReasonIDRequest, opts ...operations.Option) (*operations.PatchV1PostMortemsReportsReportIDReasonsReasonIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1PostMortemsReportsReportIdReasonsReasonId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}/reasons/{reason_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1PostMortemsReportsReportIDReasonsReasonID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1PostMortemsReportsReportIDReasonsReasonIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsReasonEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsReasonEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteReason - Delete a contributing factor -// Delete a contributing factor -func (s *PostMortems) DeleteReason(ctx context.Context, request operations.DeleteV1PostMortemsReportsReportIDReasonsReasonIDRequest, opts ...operations.Option) (*operations.DeleteV1PostMortemsReportsReportIDReasonsReasonIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1PostMortemsReportsReportIdReasonsReasonId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/reports/{report_id}/reasons/{reason_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1PostMortemsReportsReportIDReasonsReasonIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PostMortemsReasonEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PostMortemsReasonEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetQuestion - Get an incident retrospective question configured to be provided and filled out on each retrospective report. -// Get an incident retrospective question -func (s *PostMortems) GetQuestion(ctx context.Context, request operations.GetV1PostMortemsQuestionsQuestionIDRequest, opts ...operations.Option) (*operations.GetV1PostMortemsQuestionsQuestionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1PostMortemsQuestionsQuestionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/post_mortems/questions/{question_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1PostMortemsQuestionsQuestionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/priorities.go b/internal/sdk/priorities.go deleted file mode 100644 index 3045531..0000000 --- a/internal/sdk/priorities.go +++ /dev/null @@ -1,633 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Priorities - Operations about priorities -type Priorities struct { - sdkConfiguration sdkConfiguration -} - -func newPriorities(sdkConfig sdkConfiguration) *Priorities { - return &Priorities{ - sdkConfiguration: sdkConfig, - } -} - -// Create priority -// Create a new priority -func (s *Priorities) Create(ctx context.Context, request shared.PostV1Priorities, opts ...operations.Option) (*operations.PostV1PrioritiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Priorities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/priorities") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1PrioritiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List - Lists priorities -// Lists priorities -func (s *Priorities) List(ctx context.Context, request operations.GetV1PrioritiesRequest, opts ...operations.Option) (*operations.GetV1PrioritiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Priorities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/priorities") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1PrioritiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a specific priority -// Delete a specific priority -func (s *Priorities) Delete(ctx context.Context, request operations.DeleteV1PrioritiesPrioritySlugRequest, opts ...operations.Option) (*operations.DeleteV1PrioritiesPrioritySlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1PrioritiesPrioritySlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/priorities/{priority_slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1PrioritiesPrioritySlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a specific priority -// Update a specific priority -func (s *Priorities) Update(ctx context.Context, request operations.PatchV1PrioritiesPrioritySlugRequest, opts ...operations.Option) (*operations.PatchV1PrioritiesPrioritySlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1PrioritiesPrioritySlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/priorities/{priority_slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1PrioritiesPrioritySlug", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1PrioritiesPrioritySlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a specific priority -// Retrieve a specific priority -func (s *Priorities) Get(ctx context.Context, request operations.GetV1PrioritiesPrioritySlugRequest, opts ...operations.Option) (*operations.GetV1PrioritiesPrioritySlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1PrioritiesPrioritySlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/priorities/{priority_slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1PrioritiesPrioritySlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.PriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/processinglogentries.go b/internal/sdk/processinglogentries.go deleted file mode 100644 index 848faf5..0000000 --- a/internal/sdk/processinglogentries.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// ProcessingLogEntries - Operations about processing_log_entries -type ProcessingLogEntries struct { - sdkConfiguration sdkConfiguration -} - -func newProcessingLogEntries(sdkConfig sdkConfiguration) *ProcessingLogEntries { - return &ProcessingLogEntries{ - sdkConfiguration: sdkConfig, - } -} - -// List - Processing Log Entries for a specific alert -// Processing Log Entries for a specific alert -func (s *ProcessingLogEntries) List(ctx context.Context, request operations.GetV1ProcessingLogEntriesRequest, opts ...operations.Option) (*operations.GetV1ProcessingLogEntriesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ProcessingLogEntries", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/processing_log_entries") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ProcessingLogEntriesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.AlertsProcessingLogEntryEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.AlertsProcessingLogEntryEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/projects.go b/internal/sdk/projects.go deleted file mode 100644 index ca9b079..0000000 --- a/internal/sdk/projects.go +++ /dev/null @@ -1,362 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type Projects struct { - sdkConfiguration sdkConfiguration -} - -func newProjects(sdkConfig sdkConfiguration) *Projects { - return &Projects{ - sdkConfiguration: sdkConfig, - } -} - -// List all ticketing projects -// List all ticketing projects available to the organization -func (s *Projects) List(ctx context.Context, request operations.GetV1TicketingProjectsRequest, opts ...operations.Option) (*operations.GetV1TicketingProjectsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingProjects", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ticketing/projects") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingProjectsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectsProjectListItemEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectsProjectListItemEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a ticketing projects -// Retrieve a single ticketing project by ID -func (s *Projects) Get(ctx context.Context, request operations.GetV1TicketingProjectsTicketingProjectIDRequest, opts ...operations.Option) (*operations.GetV1TicketingProjectsTicketingProjectIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingProjectsTicketingProjectId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingProjectsTicketingProjectIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectsProjectListItemEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectsProjectListItemEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Projects) GetConfigurationOptionsForField(ctx context.Context, request operations.GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDRequest, opts ...operations.Option) (*operations.GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingProjectsTicketingProjectIdConfigurationOptionsOptionsForFieldId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/configuration_options/options_for/{field_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsOptionsForFieldIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/reports.go b/internal/sdk/reports.go deleted file mode 100644 index 68a35c3..0000000 --- a/internal/sdk/reports.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Reports - Operations about reports -type Reports struct { - sdkConfiguration sdkConfiguration -} - -func newReports(sdkConfig sdkConfiguration) *Reports { - return &Reports{ - sdkConfiguration: sdkConfig, - } -} - -// GetMeanTime - Get mean time report -// Returns a report with time bucketed analytics data -func (s *Reports) GetMeanTime(ctx context.Context, request operations.GetV1ReportsMeanTimeRequest, opts ...operations.Option) (*operations.GetV1ReportsMeanTimeResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ReportsMeanTime", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/reports/mean_time") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ReportsMeanTimeResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ReportEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ReportEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/retry/config.go b/internal/sdk/retry/config.go deleted file mode 100644 index c051b0a..0000000 --- a/internal/sdk/retry/config.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package retry - -type BackoffStrategy struct { - InitialInterval int - MaxInterval int - Exponent float64 - MaxElapsedTime int -} - -type Config struct { - Strategy string - Backoff *BackoffStrategy - RetryConnectionErrors bool -} diff --git a/internal/sdk/roleassignments.go b/internal/sdk/roleassignments.go deleted file mode 100644 index fbb3319..0000000 --- a/internal/sdk/roleassignments.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type RoleAssignments struct { - sdkConfiguration sdkConfiguration -} - -func newRoleAssignments(sdkConfig sdkConfiguration) *RoleAssignments { - return &RoleAssignments{ - sdkConfiguration: sdkConfig, - } -} - -// Delete - Unassign a role -// Unassign a role from a user -func (s *RoleAssignments) Delete(ctx context.Context, request operations.DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDRequest, opts ...operations.Option) (*operations.DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1IncidentsIncidentIdRoleAssignmentsRoleAssignmentId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/incidents/{incident_id}/role_assignments/{role_assignment_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1IncidentsIncidentIDRoleAssignmentsRoleAssignmentIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.IncidentsRoleAssignmentEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.IncidentsRoleAssignmentEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/runbookaudits.go b/internal/sdk/runbookaudits.go deleted file mode 100644 index ff781aa..0000000 --- a/internal/sdk/runbookaudits.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" - "net/url" -) - -type RunbookAudits struct { - sdkConfiguration sdkConfiguration -} - -func newRunbookAudits(sdkConfig sdkConfiguration) *RunbookAudits { - return &RunbookAudits{ - sdkConfiguration: sdkConfig, - } -} - -// List runbook audits -// Please contact support to enable audit logging for your account. -func (s *RunbookAudits) List(ctx context.Context, request operations.GetV1RunbookAuditsRequest, opts ...operations.Option) (*operations.GetV1RunbookAuditsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbookAudits", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/runbook_audits") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbookAuditsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/runbooks.go b/internal/sdk/runbooks.go deleted file mode 100644 index ba777ea..0000000 --- a/internal/sdk/runbooks.go +++ /dev/null @@ -1,1707 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Runbooks - Operations about runbooks -type Runbooks struct { - Executions *Executions - - sdkConfiguration sdkConfiguration -} - -func newRunbooks(sdkConfig sdkConfiguration) *Runbooks { - return &Runbooks{ - sdkConfiguration: sdkConfig, - Executions: newExecutions(sdkConfig), - } -} - -// ListActions - List all Runbook actions -// List all Runbook actions available through your connected integrations -func (s *Runbooks) ListActions(ctx context.Context, request operations.GetV1RunbooksActionsRequest, opts ...operations.Option) (*operations.GetV1RunbooksActionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbooksActions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/runbooks/actions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksActionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbooksActionsEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbooksActionsEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Execute - Create a runbook execution -// Attaches a runbook to an incident and executes it -func (s *Runbooks) Execute(ctx context.Context, request shared.PostV1RunbooksExecutions, opts ...operations.Option) (*operations.PostV1RunbooksExecutionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1RunbooksExecutions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/runbooks/executions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1RunbooksExecutionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbooksExecutionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbooksExecutionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListExecutions - List all executions of Runbooks -// List all Runbook executions across all Runbooks -func (s *Runbooks) ListExecutions(ctx context.Context, request operations.GetV1RunbooksExecutionsRequest, opts ...operations.Option) (*operations.GetV1RunbooksExecutionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbooksExecutions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/runbooks/executions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksExecutionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbooksExecutionEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbooksExecutionEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetExecution - Retrieve a runbook execution -// Retrieve a runbook execution by ID -func (s *Runbooks) GetExecution(ctx context.Context, request operations.GetV1RunbooksExecutionsExecutionIDRequest, opts ...operations.Option) (*operations.GetV1RunbooksExecutionsExecutionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbooksExecutionsExecutionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksExecutionsExecutionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbooksExecutionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbooksExecutionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetVoteStatus - Returns the current vote counts for an object -// Returns the current vote counts for an object -func (s *Runbooks) GetVoteStatus(ctx context.Context, request operations.GetV1RunbooksExecutionsExecutionIDVotesStatusRequest, opts ...operations.Option) (*operations.GetV1RunbooksExecutionsExecutionIDVotesStatusResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbooksExecutionsExecutionIdVotesStatus", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}/votes/status", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksExecutionsExecutionIDVotesStatusResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.VotesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.VotesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateStepExecution - Updates a runbook step execution -// Updates a runbook step execution, especially for changing the state of a step execution. -func (s *Runbooks) UpdateStepExecution(ctx context.Context, request operations.PutV1RunbooksExecutionsExecutionIDStepsStepIDRequest, opts ...operations.Option) (*operations.PutV1RunbooksExecutionsExecutionIDStepsStepIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1RunbooksExecutionsExecutionIdStepsStepId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}/steps/{step_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PutV1RunbooksExecutionsExecutionIDStepsStepID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1RunbooksExecutionsExecutionIDStepsStepIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbooksExecutionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbooksExecutionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateVote - Update the votes on an object -// Allows for upvoting or downvoting an event -func (s *Runbooks) UpdateVote(ctx context.Context, request operations.PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesRequest, opts ...operations.Option) (*operations.PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1RunbooksExecutionsExecutionIdStepsStepIdVotes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}/steps/{step_id}/votes", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotes", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1RunbooksExecutionsExecutionIDStepsStepIDVotesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.VotesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.VotesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetScript - Retrieves the bash script from a "script" step. -// Retrieves the bash script from a "script" step. -func (s *Runbooks) GetScript(ctx context.Context, request operations.GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptRequest, opts ...operations.Option) (*operations.GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbooksExecutionsExecutionIdStepsStepIdScript", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}/steps/{step_id}/script", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksExecutionsExecutionIDStepsStepIDScriptResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbooksExecutionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbooksExecutionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Runbooks) GetSelectOptions(ctx context.Context, request operations.GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldRequest, opts ...operations.Option) (*operations.GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbooksSelectOptionsIntegrationSlugActionSlugField", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/select_options/{integration_slug}/{action_slug}/{field}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksSelectOptionsIntegrationSlugActionSlugFieldResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Create a runbook -// Create a new runbook for use with incidents. -func (s *Runbooks) Create(ctx context.Context, request shared.PostV1Runbooks, opts ...operations.Option) (*operations.PostV1RunbooksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Runbooks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/runbooks") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1RunbooksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List runbooks -// Lists all available runbooks. -func (s *Runbooks) List(ctx context.Context, request operations.GetV1RunbooksRequest, opts ...operations.Option) (*operations.GetV1RunbooksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Runbooks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/runbooks") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a runbook -// Delete a runbook and make it unavailable for any future incidents. -func (s *Runbooks) Delete(ctx context.Context, request operations.DeleteV1RunbooksRunbookIDRequest, opts ...operations.Option) (*operations.DeleteV1RunbooksRunbookIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1RunbooksRunbookId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/{runbook_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1RunbooksRunbookIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Put - Update a runbook -// Update a runbook and any attachment rules associated with it. This endpoint is used to configure nearly everything -// about a runbook, including but not limited to the steps, environments, attachment rules, and severities. -func (s *Runbooks) Put(ctx context.Context, request operations.PutV1RunbooksRunbookIDRequest, opts ...operations.Option) (*operations.PutV1RunbooksRunbookIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1RunbooksRunbookId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/{runbook_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PutV1RunbooksRunbookID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1RunbooksRunbookIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a runbook -// Get a runbook and all its configuration -func (s *Runbooks) Get(ctx context.Context, request operations.GetV1RunbooksRunbookIDRequest, opts ...operations.Option) (*operations.GetV1RunbooksRunbookIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1RunbooksRunbookId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/{runbook_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1RunbooksRunbookIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/savedsearches.go b/internal/sdk/savedsearches.go deleted file mode 100644 index a4531f4..0000000 --- a/internal/sdk/savedsearches.go +++ /dev/null @@ -1,611 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type SavedSearches struct { - sdkConfiguration sdkConfiguration -} - -func newSavedSearches(sdkConfig sdkConfiguration) *SavedSearches { - return &SavedSearches{ - sdkConfiguration: sdkConfig, - } -} - -// Delete a specific saved search -// Delete a specific saved search -func (s *SavedSearches) Delete(ctx context.Context, request operations.DeleteV1SavedSearchesResourceTypeSavedSearchIDRequest, opts ...operations.Option) (*operations.DeleteV1SavedSearchesResourceTypeSavedSearchIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1SavedSearchesResourceTypeSavedSearchId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/saved_searches/{resource_type}/{saved_search_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1SavedSearchesResourceTypeSavedSearchIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a specific saved search -// Update a specific saved search -func (s *SavedSearches) Update(ctx context.Context, request operations.PatchV1SavedSearchesResourceTypeSavedSearchIDRequest, opts ...operations.Option) (*operations.PatchV1SavedSearchesResourceTypeSavedSearchIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1SavedSearchesResourceTypeSavedSearchId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/saved_searches/{resource_type}/{saved_search_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1SavedSearchesResourceTypeSavedSearchID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1SavedSearchesResourceTypeSavedSearchIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SavedSearchEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SavedSearchEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List - Lists save searches -// Lists save searches -func (s *SavedSearches) List(ctx context.Context, request operations.GetV1SavedSearchesResourceTypeRequest, opts ...operations.Option) (*operations.GetV1SavedSearchesResourceTypeResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SavedSearchesResourceType", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/saved_searches/{resource_type}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SavedSearchesResourceTypeResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SavedSearchEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SavedSearchEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Create saved search -// Create a new saved search for a particular resource type -func (s *SavedSearches) Create(ctx context.Context, request operations.PostV1SavedSearchesResourceTypeRequest, opts ...operations.Option) (*operations.PostV1SavedSearchesResourceTypeResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1SavedSearchesResourceType", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/saved_searches/{resource_type}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1SavedSearchesResourceType", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1SavedSearchesResourceTypeResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SavedSearchEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SavedSearchEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a specific save search -// Retrieve a specific save search -func (s *SavedSearches) Get(ctx context.Context, request operations.GetV1SavedSearchesResourceTypeSavedSearchIDRequest, opts ...operations.Option) (*operations.GetV1SavedSearchesResourceTypeSavedSearchIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SavedSearchesResourceTypeSavedSearchId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/saved_searches/{resource_type}/{saved_search_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SavedSearchesResourceTypeSavedSearchIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SavedSearchEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SavedSearchEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/scheduledmaintenances.go b/internal/sdk/scheduledmaintenances.go deleted file mode 100644 index bc22161..0000000 --- a/internal/sdk/scheduledmaintenances.go +++ /dev/null @@ -1,634 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// ScheduledMaintenances - Operations about scheduled_maintenances -type ScheduledMaintenances struct { - sdkConfiguration sdkConfiguration -} - -func newScheduledMaintenances(sdkConfig sdkConfiguration) *ScheduledMaintenances { - return &ScheduledMaintenances{ - sdkConfiguration: sdkConfig, - } -} - -// Create a scheduled maintenance event -// Create a new scheduled maintenance event -func (s *ScheduledMaintenances) Create(ctx context.Context, request shared.PostV1ScheduledMaintenances, opts ...operations.Option) (*operations.PostV1ScheduledMaintenancesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ScheduledMaintenances", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/scheduled_maintenances") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ScheduledMaintenancesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ScheduledMaintenanceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ScheduledMaintenanceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListAll - List scheduled maintenance events -// Lists all scheduled maintenance events -func (s *ScheduledMaintenances) ListAll(ctx context.Context, request operations.GetV1ScheduledMaintenancesRequest, opts ...operations.Option) (*operations.GetV1ScheduledMaintenancesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ScheduledMaintenances", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/scheduled_maintenances") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ScheduledMaintenancesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ScheduledMaintenanceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ScheduledMaintenanceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a scheduled maintenance event -// Change the conditions of a scheduled maintenance event, including updating any status page announcements of changes. -func (s *ScheduledMaintenances) Update(ctx context.Context, request operations.PatchV1ScheduledMaintenancesScheduledMaintenanceIDRequest, opts ...operations.Option) (*operations.PatchV1ScheduledMaintenancesScheduledMaintenanceIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1ScheduledMaintenancesScheduledMaintenanceId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scheduled_maintenances/{scheduled_maintenance_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1ScheduledMaintenancesScheduledMaintenanceID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1ScheduledMaintenancesScheduledMaintenanceIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ScheduledMaintenanceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ScheduledMaintenanceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a scheduled maintenance event -// Fetch the details of a scheduled maintenance event. -func (s *ScheduledMaintenances) Get(ctx context.Context, request operations.GetV1ScheduledMaintenancesScheduledMaintenanceIDRequest, opts ...operations.Option) (*operations.GetV1ScheduledMaintenancesScheduledMaintenanceIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ScheduledMaintenancesScheduledMaintenanceId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scheduled_maintenances/{scheduled_maintenance_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ScheduledMaintenancesScheduledMaintenanceIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ScheduledMaintenanceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ScheduledMaintenanceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a scheduled maintenance event -// Delete a scheduled maintenance event, preventing it from taking place. -func (s *ScheduledMaintenances) Delete(ctx context.Context, request operations.DeleteV1ScheduledMaintenancesScheduledMaintenanceIDRequest, opts ...operations.Option) (*operations.DeleteV1ScheduledMaintenancesScheduledMaintenanceIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ScheduledMaintenancesScheduledMaintenanceId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scheduled_maintenances/{scheduled_maintenance_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ScheduledMaintenancesScheduledMaintenanceIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/schedules.go b/internal/sdk/schedules.go deleted file mode 100644 index b633186..0000000 --- a/internal/sdk/schedules.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Schedules - Operations about schedules -type Schedules struct { - sdkConfiguration sdkConfiguration -} - -func newSchedules(sdkConfig sdkConfiguration) *Schedules { - return &Schedules{ - sdkConfiguration: sdkConfig, - } -} - -// List all schedules -// List all known schedules in FireHydrant as pulled from external sources -func (s *Schedules) List(ctx context.Context, request operations.GetV1SchedulesRequest, opts ...operations.Option) (*operations.GetV1SchedulesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Schedules", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/schedules") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SchedulesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ScheduleEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ScheduleEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/scim.go b/internal/sdk/scim.go deleted file mode 100644 index ebcfa9a..0000000 --- a/internal/sdk/scim.go +++ /dev/null @@ -1,943 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Scim - Operations about scims -type Scim struct { - Users *FirehydrantUsers - - sdkConfiguration sdkConfiguration -} - -func newScim(sdkConfig sdkConfiguration) *Scim { - return &Scim{ - sdkConfiguration: sdkConfig, - Users: newFirehydrantUsers(sdkConfig), - } -} - -// UpdateGroup - Updates a Team (via the Group protocol) and assigns members to that team. -// SCIM endpoint to update a Team (Colloquial for Group in the SCIM protocol). Any members defined in the payload will be assigned to the team with no defined role, any missing members will be removed from the team. -func (s *Scim) UpdateGroup(ctx context.Context, request operations.PutV1ScimV2GroupsIDRequest, opts ...operations.Option) (*operations.PutV1ScimV2GroupsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1ScimV2GroupsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scim/v2/Groups/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PutV1ScimV2GroupsID", "json", `request:"mediaType=application/scim+json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1ScimV2GroupsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete - Deletes a Team (via the Group protocol) -// SCIM endpoint to delete a Team (Colloquial for Group in the SCIM protocol). -func (s *Scim) Delete(ctx context.Context, request operations.DeleteV1ScimV2GroupsIDRequest, opts ...operations.Option) (*operations.DeleteV1ScimV2GroupsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ScimV2GroupsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scim/v2/Groups/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ScimV2GroupsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetGroup - Lists a Team (via the Group protocol) -// SCIM endpoint that lists a Team (Colloquial for Group in the SCIM protocol) -func (s *Scim) GetGroup(ctx context.Context, request operations.GetV1ScimV2GroupsIDRequest, opts ...operations.Option) (*operations.GetV1ScimV2GroupsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ScimV2GroupsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scim/v2/Groups/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ScimV2GroupsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateTeam - Creates a new Team (via the Group protocol) and assigns members to that team. -// SCIM endpoint to create a new Team (Colloquial for Group in the SCIM protocol). Any members defined in the payload will be assigned to the team with no defined role. -func (s *Scim) CreateTeam(ctx context.Context, request shared.PostV1ScimV2Groups, opts ...operations.Option) (*operations.PostV1ScimV2GroupsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ScimV2Groups", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/scim/v2/Groups") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/scim+json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ScimV2GroupsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListTeams - List all Teams (via the Group protocol) -// SCIM endpoint that lists all Teams (Colloquial for Group in the SCIM protocol) -func (s *Scim) ListTeams(ctx context.Context, request operations.GetV1ScimV2GroupsRequest, opts ...operations.Option) (*operations.GetV1ScimV2GroupsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ScimV2Groups", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/scim/v2/Groups") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ScimV2GroupsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateUser - Updates a User using SCIM protocol -// PUT SCIM endpoint to update a User. This endpoint is used to replace a resource's attributes. -func (s *Scim) UpdateUser(ctx context.Context, request operations.PutV1ScimV2UsersIDRequest, opts ...operations.Option) (*operations.PutV1ScimV2UsersIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1ScimV2UsersId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scim/v2/Users/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PutV1ScimV2UsersID", "json", `request:"mediaType=application/scim+json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1ScimV2UsersIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetUser - Lists a User (via the User protocol) -// SCIM endpoint that lists a User -func (s *Scim) GetUser(ctx context.Context, request operations.GetV1ScimV2UsersIDRequest, opts ...operations.Option) (*operations.GetV1ScimV2UsersIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ScimV2UsersId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/scim/v2/Users/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ScimV2UsersIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateUser - Creates a new User using SCIM protocol -// SCIM endpoint to create and provision a new User. This endpoint will provision the User, which allows them to accept their account throught their IDP or via the Forgot Password flow. -func (s *Scim) CreateUser(ctx context.Context, request shared.PostV1ScimV2Users, opts ...operations.Option) (*operations.PostV1ScimV2UsersResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ScimV2Users", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/scim/v2/Users") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/scim+json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ScimV2UsersResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetUsers - Gets a list of Users using SCIM protocol -// SCIM endpoint that lists users. This endpoint will display a list of Users currently in the system. -func (s *Scim) GetUsers(ctx context.Context, request operations.GetV1ScimV2UsersRequest, opts ...operations.Option) (*operations.GetV1ScimV2UsersResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ScimV2Users", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/scim/v2/Users") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ScimV2UsersResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/servicedependencies.go b/internal/sdk/servicedependencies.go deleted file mode 100644 index ee58f74..0000000 --- a/internal/sdk/servicedependencies.go +++ /dev/null @@ -1,510 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type ServiceDependencies struct { - sdkConfiguration sdkConfiguration -} - -func newServiceDependencies(sdkConfig sdkConfiguration) *ServiceDependencies { - return &ServiceDependencies{ - sdkConfiguration: sdkConfig, - } -} - -// Create a service dependency -// Creates a service dependency relationship between two services -func (s *ServiceDependencies) Create(ctx context.Context, request shared.PostV1ServiceDependencies, opts ...operations.Option) (*operations.PostV1ServiceDependenciesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ServiceDependencies", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/service_dependencies") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ServiceDependenciesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceDependencyEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceDependencyEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a service dependency -// Deletes a single service dependency -func (s *ServiceDependencies) Delete(ctx context.Context, request operations.DeleteV1ServiceDependenciesServiceDependencyIDRequest, opts ...operations.Option) (*operations.DeleteV1ServiceDependenciesServiceDependencyIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ServiceDependenciesServiceDependencyId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/service_dependencies/{service_dependency_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ServiceDependenciesServiceDependencyIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceDependencyEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceDependencyEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a service dependency -// Update the notes of the service dependency -func (s *ServiceDependencies) Update(ctx context.Context, request operations.PatchV1ServiceDependenciesServiceDependencyIDRequest, opts ...operations.Option) (*operations.PatchV1ServiceDependenciesServiceDependencyIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1ServiceDependenciesServiceDependencyId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/service_dependencies/{service_dependency_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1ServiceDependenciesServiceDependencyID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1ServiceDependenciesServiceDependencyIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceDependencyEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceDependencyEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a single service dependency -// Retrieves a single service dependency by ID -func (s *ServiceDependencies) Get(ctx context.Context, request operations.GetV1ServiceDependenciesServiceDependencyIDRequest, opts ...operations.Option) (*operations.GetV1ServiceDependenciesServiceDependencyIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ServiceDependenciesServiceDependencyId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/service_dependencies/{service_dependency_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ServiceDependenciesServiceDependencyIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceDependencyEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceDependencyEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/services.go b/internal/sdk/services.go deleted file mode 100644 index 55fb4f3..0000000 --- a/internal/sdk/services.go +++ /dev/null @@ -1,1339 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Services - Operations about services -type Services struct { - sdkConfiguration sdkConfiguration -} - -func newServices(sdkConfig sdkConfiguration) *Services { - return &Services{ - sdkConfiguration: sdkConfig, - } -} - -// Create a service -// Creates a service for the organization, you may also create or attach functionalities to the service on create. -func (s *Services) Create(ctx context.Context, request shared.PostV1Services, opts ...operations.Option) (*operations.PostV1ServicesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Services", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/services") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ServicesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ErrorEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ErrorEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all services -// List all of the services that have been added to the organization. -func (s *Services) List(ctx context.Context, request operations.GetV1ServicesRequest, opts ...operations.Option) (*operations.GetV1ServicesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Services", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/services") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ServicesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateServiceLinks - Bulk create services and service links -// Creates a service with the appropriate integration for each external service ID passed -func (s *Services) CreateServiceLinks(ctx context.Context, request shared.PostV1ServicesServiceLinks, opts ...operations.Option) (*operations.PostV1ServicesServiceLinksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ServicesServiceLinks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/services/service_links") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ServicesServiceLinksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out []shared.ServiceLinkEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceLinkEntities = out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a service -// Deletes the service from FireHydrant. -func (s *Services) Delete(ctx context.Context, request operations.DeleteV1ServicesServiceIDRequest, opts ...operations.Option) (*operations.DeleteV1ServicesServiceIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ServicesServiceId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/services/{service_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ServicesServiceIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a service -// Update a services attributes, you may also add or remove functionalities from the service as well. -// Note: You may not remove or add individual label key/value pairs. You must include the entire object to override label values. -func (s *Services) Update(ctx context.Context, request operations.PatchV1ServicesServiceIDRequest, opts ...operations.Option) (*operations.PatchV1ServicesServiceIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1ServicesServiceId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/services/{service_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1ServicesServiceID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1ServicesServiceIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a single service -// Retrieves a single service by ID -func (s *Services) Get(ctx context.Context, request operations.GetV1ServicesServiceIDRequest, opts ...operations.Option) (*operations.GetV1ServicesServiceIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ServicesServiceId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/services/{service_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ServicesServiceIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetDependencies - Retrieve a service's dependencies -// Retrieves a service's dependencies -func (s *Services) GetDependencies(ctx context.Context, request operations.GetV1ServicesServiceIDDependenciesRequest, opts ...operations.Option) (*operations.GetV1ServicesServiceIDDependenciesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ServicesServiceIdDependencies", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/services/{service_id}/dependencies", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ServicesServiceIDDependenciesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceWithAllDependenciesEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceWithAllDependenciesEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetAvailableUpstreamDependencies - Retrieve all available upstream dependencies -// Retrieves all services that are available to be upstream dependencies -func (s *Services) GetAvailableUpstreamDependencies(ctx context.Context, request operations.GetV1ServicesServiceIDAvailableUpstreamDependenciesRequest, opts ...operations.Option) (*operations.GetV1ServicesServiceIDAvailableUpstreamDependenciesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ServicesServiceIdAvailableUpstreamDependencies", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/services/{service_id}/available_upstream_dependencies", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ServicesServiceIDAvailableUpstreamDependenciesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListAvailableDownstreamDependencies - Retrieve all available downstream dependencies -// Retrieves all services that are available to be downstream dependencies -func (s *Services) ListAvailableDownstreamDependencies(ctx context.Context, request operations.GetV1ServicesServiceIDAvailableDownstreamDependenciesRequest, opts ...operations.Option) (*operations.GetV1ServicesServiceIDAvailableDownstreamDependenciesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1ServicesServiceIdAvailableDownstreamDependencies", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/services/{service_id}/available_downstream_dependencies", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1ServicesServiceIDAvailableDownstreamDependenciesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.ServiceEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.ServiceEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteServiceLink - Delete a service link -// Deletes a service link from FireHydrant. -func (s *Services) DeleteServiceLink(ctx context.Context, request operations.DeleteV1ServicesServiceIDServiceLinksRemoteIDRequest, opts ...operations.Option) (*operations.DeleteV1ServicesServiceIDServiceLinksRemoteIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1ServicesServiceIdServiceLinksRemoteId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/services/{service_id}/service_links/{remote_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1ServicesServiceIDServiceLinksRemoteIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateChecklistResponse - Record a response for a checklist item -// Creates a response for a checklist item -func (s *Services) CreateChecklistResponse(ctx context.Context, request operations.PostV1ServicesServiceIDChecklistResponseChecklistIDRequest, opts ...operations.Option) (*operations.PostV1ServicesServiceIDChecklistResponseChecklistIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1ServicesServiceIdChecklistResponseChecklistId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/services/{service_id}/checklist_response/{checklist_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1ServicesServiceIDChecklistResponseChecklistID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1ServicesServiceIDChecklistResponseChecklistIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/severities.go b/internal/sdk/severities.go deleted file mode 100644 index 14abff9..0000000 --- a/internal/sdk/severities.go +++ /dev/null @@ -1,633 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Severities - Operations about severities -type Severities struct { - sdkConfiguration sdkConfiguration -} - -func newSeverities(sdkConfig sdkConfiguration) *Severities { - return &Severities{ - sdkConfiguration: sdkConfig, - } -} - -// Create severity -// Create a new severity -func (s *Severities) Create(ctx context.Context, request shared.PostV1Severities, opts ...operations.Option) (*operations.PostV1SeveritiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Severities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/severities") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1SeveritiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Lists severities -// Lists severities -func (s *Severities) Get(ctx context.Context, request operations.GetV1SeveritiesRequest, opts ...operations.Option) (*operations.GetV1SeveritiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Severities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/severities") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SeveritiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a specific severity -// Delete a specific severity -func (s *Severities) Delete(ctx context.Context, request operations.DeleteV1SeveritiesSeveritySlugRequest, opts ...operations.Option) (*operations.DeleteV1SeveritiesSeveritySlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1SeveritiesSeveritySlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/severities/{severity_slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1SeveritiesSeveritySlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a specific severity -// Update a specific severity -func (s *Severities) Update(ctx context.Context, request operations.PatchV1SeveritiesSeveritySlugRequest, opts ...operations.Option) (*operations.PatchV1SeveritiesSeveritySlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1SeveritiesSeveritySlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/severities/{severity_slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1SeveritiesSeveritySlug", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1SeveritiesSeveritySlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Retrieve a specific severity -// Retrieve a specific severity -func (s *Severities) Retrieve(ctx context.Context, request operations.GetV1SeveritiesSeveritySlugRequest, opts ...operations.Option) (*operations.GetV1SeveritiesSeveritySlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SeveritiesSeveritySlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/severities/{severity_slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SeveritiesSeveritySlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/severitymatrix.go b/internal/sdk/severitymatrix.go deleted file mode 100644 index 0d9eee8..0000000 --- a/internal/sdk/severitymatrix.go +++ /dev/null @@ -1,1221 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type SeverityMatrix struct { - Conditions *Conditions - - sdkConfiguration sdkConfiguration -} - -func newSeverityMatrix(sdkConfig sdkConfiguration) *SeverityMatrix { - return &SeverityMatrix{ - sdkConfiguration: sdkConfig, - Conditions: newConditions(sdkConfig), - } -} - -// Patch - Update your severity matrix -// Update available severities and impacts in your organization's severity matrix. -func (s *SeverityMatrix) Patch(ctx context.Context, request shared.PatchV1SeverityMatrix, opts ...operations.Option) (*operations.PatchV1SeverityMatrixResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1SeverityMatrix", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/severity_matrix") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1SeverityMatrixResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixSeverityMatrixEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixSeverityMatrixEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve your severity matrix -// Retrieve the Severity matrix for your organization and its components and configured severities. -func (s *SeverityMatrix) Get(ctx context.Context, opts ...operations.Option) (*operations.GetV1SeverityMatrixResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SeverityMatrix", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/severity_matrix") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SeverityMatrixResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixSeverityMatrixEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixSeverityMatrixEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateCondition - Create condition -// Create a new condition -func (s *SeverityMatrix) CreateCondition(ctx context.Context, request shared.PostV1SeverityMatrixConditions, opts ...operations.Option) (*operations.PostV1SeverityMatrixConditionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1SeverityMatrixConditions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/severity_matrix/conditions") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1SeverityMatrixConditionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixConditionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixConditionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateCondition - Update a specific condition -// Update a specific condition -func (s *SeverityMatrix) UpdateCondition(ctx context.Context, request operations.PatchV1SeverityMatrixConditionsConditionIDRequest, opts ...operations.Option) (*operations.PatchV1SeverityMatrixConditionsConditionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1SeverityMatrixConditionsConditionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/severity_matrix/conditions/{condition_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1SeverityMatrixConditionsConditionID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1SeverityMatrixConditionsConditionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixConditionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixConditionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *SeverityMatrix) GetCondition(ctx context.Context, request operations.GetV1SeverityMatrixConditionsConditionIDRequest, opts ...operations.Option) (*operations.GetV1SeverityMatrixConditionsConditionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SeverityMatrixConditionsConditionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/severity_matrix/conditions/{condition_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SeverityMatrixConditionsConditionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateImpact - Create impact -// Create a new impact -func (s *SeverityMatrix) CreateImpact(ctx context.Context, request shared.PostV1SeverityMatrixImpacts, opts ...operations.Option) (*operations.PostV1SeverityMatrixImpactsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1SeverityMatrixImpacts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/severity_matrix/impacts") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1SeverityMatrixImpactsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixImpactEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixImpactEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteImpact - Delete a specific impact -// Delete a specific impact -func (s *SeverityMatrix) DeleteImpact(ctx context.Context, request operations.DeleteV1SeverityMatrixImpactsImpactIDRequest, opts ...operations.Option) (*operations.DeleteV1SeverityMatrixImpactsImpactIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1SeverityMatrixImpactsImpactId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/severity_matrix/impacts/{impact_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1SeverityMatrixImpactsImpactIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixImpactEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixImpactEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateImpact - Update a specific impact -// Update a specific impact -func (s *SeverityMatrix) UpdateImpact(ctx context.Context, request operations.PatchV1SeverityMatrixImpactsImpactIDRequest, opts ...operations.Option) (*operations.PatchV1SeverityMatrixImpactsImpactIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1SeverityMatrixImpactsImpactId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/severity_matrix/impacts/{impact_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1SeverityMatrixImpactsImpactID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1SeverityMatrixImpactsImpactIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixImpactEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixImpactEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteCondition - Delete a specific condition -// Delete a specific condition -func (s *SeverityMatrix) DeleteCondition(ctx context.Context, request operations.DeleteV1SeverityMatrixConditionsConditionIDRequest, opts ...operations.Option) (*operations.DeleteV1SeverityMatrixConditionsConditionIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1SeverityMatrixConditionsConditionId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/severity_matrix/conditions/{condition_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1SeverityMatrixConditionsConditionIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixConditionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixConditionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListImpacts - Lists impacts -// Lists impacts -func (s *SeverityMatrix) ListImpacts(ctx context.Context, request operations.GetV1SeverityMatrixImpactsRequest, opts ...operations.Option) (*operations.GetV1SeverityMatrixImpactsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SeverityMatrixImpacts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/severity_matrix/impacts") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SeverityMatrixImpactsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SeverityMatrixImpactEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SeverityMatrixImpactEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/signalrules.go b/internal/sdk/signalrules.go deleted file mode 100644 index 994d084..0000000 --- a/internal/sdk/signalrules.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type SignalRules struct { - sdkConfiguration sdkConfiguration -} - -func newSignalRules(sdkConfig sdkConfiguration) *SignalRules { - return &SignalRules{ - sdkConfiguration: sdkConfig, - } -} - -// Create a Signals rule -// Create a Signals rule for a team. -func (s *SignalRules) Create(ctx context.Context, request operations.PostV1TeamsTeamIDSignalRulesRequest, opts ...operations.Option) (*operations.PostV1TeamsTeamIDSignalRulesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TeamsTeamIdSignalRules", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/signal_rules", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1TeamsTeamIDSignalRules", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TeamsTeamIDSignalRulesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a Signals rule -// Delete a Signals rule by ID -func (s *SignalRules) Delete(ctx context.Context, request operations.DeleteV1TeamsTeamIDSignalRulesIDRequest, opts ...operations.Option) (*operations.DeleteV1TeamsTeamIDSignalRulesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TeamsTeamIdSignalRulesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/signal_rules/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TeamsTeamIDSignalRulesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get a Signals rule -// Get a Signals rule by ID. -func (s *SignalRules) Get(ctx context.Context, request operations.GetV1TeamsTeamIDSignalRulesIDRequest, opts ...operations.Option) (*operations.GetV1TeamsTeamIDSignalRulesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TeamsTeamIdSignalRulesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/signal_rules/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsTeamIDSignalRulesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/signals.go b/internal/sdk/signals.go deleted file mode 100644 index 5cde084..0000000 --- a/internal/sdk/signals.go +++ /dev/null @@ -1,1478 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Signals - Operations about signals -type Signals struct { - WebhookTargets *WebhookTargets - - sdkConfiguration sdkConfiguration -} - -func newSignals(sdkConfig sdkConfiguration) *Signals { - return &Signals{ - sdkConfiguration: sdkConfig, - WebhookTargets: newWebhookTargets(sdkConfig), - } -} - -// GenerateTimeseriesMetrics - Generate timeseries alert metrics -// Generate a timeseries-based report of metrics for Signals alerts -func (s *Signals) GenerateTimeseriesMetrics(ctx context.Context, request operations.GetV1SignalsAnalyticsTimeseriesRequest, opts ...operations.Option) (*operations.GetV1SignalsAnalyticsTimeseriesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsAnalyticsTimeseries", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/analytics/timeseries") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsAnalyticsTimeseriesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetGroupedMetrics - Generate grouped alert metrics -// Generate a report of grouped metrics for Signals alerts -func (s *Signals) GetGroupedMetrics(ctx context.Context, request operations.GetV1SignalsAnalyticsGroupedMetricsRequest, opts ...operations.Option) (*operations.GetV1SignalsAnalyticsGroupedMetricsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsAnalyticsGroupedMetrics", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/analytics/grouped_metrics") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsAnalyticsGroupedMetricsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetMttxMetrics - Get MTTX metrics for Signals Alerts -// Get mean-time-to-acknowledged (MTTA) and mean-time-to-resolved (MTTR) metrics for Signals alerts -func (s *Signals) GetMttxMetrics(ctx context.Context, request operations.GetV1SignalsAnalyticsMttxRequest, opts ...operations.Option) (*operations.GetV1SignalsAnalyticsMttxResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsAnalyticsMttx", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/analytics/mttx") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsAnalyticsMttxResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Signals) ListEventSources(ctx context.Context, request operations.GetV1SignalsEventSourcesRequest, opts ...operations.Option) (*operations.GetV1SignalsEventSourcesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsEventSources", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/event_sources") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsEventSourcesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateEmailTarget - Create an email target -// Create a Signals email target for a team. -func (s *Signals) CreateEmailTarget(ctx context.Context, request shared.PostV1SignalsEmailTargets, opts ...operations.Option) (*operations.PostV1SignalsEmailTargetsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1SignalsEmailTargets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/email_targets") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1SignalsEmailTargetsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListEmailTargets - List email targets -// List all Signals email targets for a team. -func (s *Signals) ListEmailTargets(ctx context.Context, request operations.GetV1SignalsEmailTargetsRequest, opts ...operations.Option) (*operations.GetV1SignalsEmailTargetsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsEmailTargets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/email_targets") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsEmailTargetsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteEmailTarget - Delete an email target -// Delete a Signals email target by ID -func (s *Signals) DeleteEmailTarget(ctx context.Context, request operations.DeleteV1SignalsEmailTargetsIDRequest, opts ...operations.Option) (*operations.DeleteV1SignalsEmailTargetsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1SignalsEmailTargetsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/signals/email_targets/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1SignalsEmailTargetsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateEmailTarget - Update an email target -// Update a Signals email target by ID -func (s *Signals) UpdateEmailTarget(ctx context.Context, request operations.PatchV1SignalsEmailTargetsIDRequest, opts ...operations.Option) (*operations.PatchV1SignalsEmailTargetsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1SignalsEmailTargetsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/signals/email_targets/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1SignalsEmailTargetsID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1SignalsEmailTargetsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetEmailTarget - Get an email target -// Get a Signals email target by ID -func (s *Signals) GetEmailTarget(ctx context.Context, request operations.GetV1SignalsEmailTargetsIDRequest, opts ...operations.Option) (*operations.GetV1SignalsEmailTargetsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsEmailTargetsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/signals/email_targets/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsEmailTargetsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteWebhookTarget - Delete an webhook target -// Delete a Signals webhook target by ID -func (s *Signals) DeleteWebhookTarget(ctx context.Context, request operations.DeleteV1SignalsWebhookTargetsIDRequest, opts ...operations.Option) (*operations.DeleteV1SignalsWebhookTargetsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1SignalsWebhookTargetsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/signals/webhook_targets/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1SignalsWebhookTargetsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetWebhookTarget - Get an webhook target -// Get a Signals webhook target by ID -func (s *Signals) GetWebhookTarget(ctx context.Context, request operations.GetV1SignalsWebhookTargetsIDRequest, opts ...operations.Option) (*operations.GetV1SignalsWebhookTargetsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsWebhookTargetsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/signals/webhook_targets/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsWebhookTargetsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out operations.GetV1SignalsWebhookTargetsIDResponseBody - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.Object = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Signals) GetTransposers(ctx context.Context, opts ...operations.Option) (*operations.GetV1SignalsTransposersResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsTransposers", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/transposers") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsTransposersResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetIngestURL - Retrieve the url for ingesting signals -// Retrieve the url for ingesting signals for your organization -func (s *Signals) GetIngestURL(ctx context.Context, request operations.GetV1SignalsIngestURLRequest, opts ...operations.Option) (*operations.GetV1SignalsIngestURLResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsIngestUrl", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/ingest_url") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsIngestURLResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.SignalsAPIIngestKeyEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.SignalsAPIIngestKeyEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Signals) Debug(ctx context.Context, request shared.PostV1SignalsDebugger, opts ...operations.Option) (*operations.PostV1SignalsDebuggerResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1SignalsDebugger", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/debugger") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1SignalsDebuggerResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/signalsoncall.go b/internal/sdk/signalsoncall.go deleted file mode 100644 index 962045f..0000000 --- a/internal/sdk/signalsoncall.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" - "net/url" -) - -// SignalsOnCall - Operations about signals_on_calls -type SignalsOnCall struct { - sdkConfiguration sdkConfiguration -} - -func newSignalsOnCall(sdkConfig sdkConfiguration) *SignalsOnCall { - return &SignalsOnCall{ - sdkConfiguration: sdkConfig, - } -} - -// ListSchedules - List all on-call schedules -// List all Signals on-call schedules for the entire organization. -func (s *SignalsOnCall) ListSchedules(ctx context.Context, request operations.GetV1SignalsOnCallRequest, opts ...operations.Option) (*operations.GetV1SignalsOnCallResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsOnCall", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals_on_call") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsOnCallResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/statuses.go b/internal/sdk/statuses.go deleted file mode 100644 index bb8c876..0000000 --- a/internal/sdk/statuses.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "net/http" -) - -type Statuses struct { - sdkConfiguration sdkConfiguration -} - -func newStatuses(sdkConfig sdkConfiguration) *Statuses { - return &Statuses{ - sdkConfiguration: sdkConfig, - } -} - -// Get - Retrieve an incident type -// Retrieve a single incident type from its ID -func (s *Statuses) Get(ctx context.Context, request operations.GetV1IntegrationsStatusesSlugRequest, opts ...operations.Option) (*operations.GetV1IntegrationsStatusesSlugResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1IntegrationsStatusesSlug", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/integrations/statuses/{slug}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1IntegrationsStatusesSlugResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/statusupdatetemplates.go b/internal/sdk/statusupdatetemplates.go deleted file mode 100644 index b362d85..0000000 --- a/internal/sdk/statusupdatetemplates.go +++ /dev/null @@ -1,633 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// StatusUpdateTemplates - Operations about status_update_templates -type StatusUpdateTemplates struct { - sdkConfiguration sdkConfiguration -} - -func newStatusUpdateTemplates(sdkConfig sdkConfiguration) *StatusUpdateTemplates { - return &StatusUpdateTemplates{ - sdkConfiguration: sdkConfig, - } -} - -// Create a status update template -// Create a status update template for your organization -func (s *StatusUpdateTemplates) Create(ctx context.Context, request shared.PostV1StatusUpdateTemplates, opts ...operations.Option) (*operations.PostV1StatusUpdateTemplatesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1StatusUpdateTemplates", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/status_update_templates") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1StatusUpdateTemplatesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.StatusUpdateTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.StatusUpdateTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all status update templates -// List all status update templates for your organization -func (s *StatusUpdateTemplates) List(ctx context.Context, request operations.GetV1StatusUpdateTemplatesRequest, opts ...operations.Option) (*operations.GetV1StatusUpdateTemplatesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1StatusUpdateTemplates", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/status_update_templates") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1StatusUpdateTemplatesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.StatusUpdateTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.StatusUpdateTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a status update template -// Delete a single status update template -func (s *StatusUpdateTemplates) Delete(ctx context.Context, request operations.DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest, opts ...operations.Option) (*operations.DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1StatusUpdateTemplatesStatusUpdateTemplateId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/status_update_templates/{status_update_template_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.StatusUpdateTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.StatusUpdateTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Patch - Update a status update template -// Update a single status update template -func (s *StatusUpdateTemplates) Patch(ctx context.Context, request operations.PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest, opts ...operations.Option) (*operations.PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1StatusUpdateTemplatesStatusUpdateTemplateId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/status_update_templates/{status_update_template_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1StatusUpdateTemplatesStatusUpdateTemplateID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.StatusUpdateTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.StatusUpdateTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get a status update template -// Get a single status update template by ID -func (s *StatusUpdateTemplates) Get(ctx context.Context, request operations.GetV1StatusUpdateTemplatesStatusUpdateTemplateIDRequest, opts ...operations.Option) (*operations.GetV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1StatusUpdateTemplatesStatusUpdateTemplateId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/status_update_templates/{status_update_template_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1StatusUpdateTemplatesStatusUpdateTemplateIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.StatusUpdateTemplateEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.StatusUpdateTemplateEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/steps.go b/internal/sdk/steps.go deleted file mode 100644 index 1406fab..0000000 --- a/internal/sdk/steps.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" -) - -type Steps struct { - sdkConfiguration sdkConfiguration -} - -func newSteps(sdkConfig sdkConfiguration) *Steps { - return &Steps{ - sdkConfiguration: sdkConfig, - } -} - -// UpdateScriptState - Updates the execution's step. -// Updates the execution's step. -func (s *Steps) UpdateScriptState(ctx context.Context, request operations.PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateRequest, opts ...operations.Option) (*operations.PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "putV1RunbooksExecutionsExecutionIdStepsStepIdScriptState", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/runbooks/executions/{execution_id}/steps/{step_id}/script/{state}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PUT", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PutV1RunbooksExecutionsExecutionIDStepsStepIDScriptStateResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.RunbooksExecutionEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.RunbooksExecutionEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/tasklists.go b/internal/sdk/tasklists.go deleted file mode 100644 index a319156..0000000 --- a/internal/sdk/tasklists.go +++ /dev/null @@ -1,633 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// TaskLists - Operations about task_lists -type TaskLists struct { - sdkConfiguration sdkConfiguration -} - -func newTaskLists(sdkConfig sdkConfiguration) *TaskLists { - return &TaskLists{ - sdkConfiguration: sdkConfig, - } -} - -// Create a task list -// Creates a new task list -func (s *TaskLists) Create(ctx context.Context, request shared.PostV1TaskLists, opts ...operations.Option) (*operations.PostV1TaskListsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TaskLists", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/task_lists") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TaskListsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskListEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskListEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all task lists -// Lists all task lists for your organization -func (s *TaskLists) List(ctx context.Context, request operations.GetV1TaskListsRequest, opts ...operations.Option) (*operations.GetV1TaskListsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TaskLists", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/task_lists") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TaskListsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskListEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskListEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a task list -// Delete a task list -func (s *TaskLists) Delete(ctx context.Context, request operations.DeleteV1TaskListsTaskListIDRequest, opts ...operations.Option) (*operations.DeleteV1TaskListsTaskListIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TaskListsTaskListId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/task_lists/{task_list_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TaskListsTaskListIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskListEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskListEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a task list -// Updates a task list's attributes and task list items -func (s *TaskLists) Update(ctx context.Context, request operations.PatchV1TaskListsTaskListIDRequest, opts ...operations.Option) (*operations.PatchV1TaskListsTaskListIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TaskListsTaskListId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/task_lists/{task_list_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1TaskListsTaskListID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TaskListsTaskListIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskListEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskListEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a task list -// Retrieves a single task list by ID -func (s *TaskLists) Get(ctx context.Context, request operations.GetV1TaskListsTaskListIDRequest, opts ...operations.Option) (*operations.GetV1TaskListsTaskListIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TaskListsTaskListId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/task_lists/{task_list_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TaskListsTaskListIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TaskListEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TaskListEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/teams.go b/internal/sdk/teams.go deleted file mode 100644 index 3c417a0..0000000 --- a/internal/sdk/teams.go +++ /dev/null @@ -1,1960 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Teams - Operations about teams -type Teams struct { - EscalationPolicies *EscalationPolicies - OnCallSchedules *OnCallSchedules - SignalRules *SignalRules - - sdkConfiguration sdkConfiguration -} - -func newTeams(sdkConfig sdkConfiguration) *Teams { - return &Teams{ - sdkConfiguration: sdkConfig, - EscalationPolicies: newEscalationPolicies(sdkConfig), - OnCallSchedules: newOnCallSchedules(sdkConfig), - SignalRules: newSignalRules(sdkConfig), - } -} - -// Post - Create a team -// Create a new team -func (s *Teams) Post(ctx context.Context, request shared.PostV1Teams, opts ...operations.Option) (*operations.PostV1TeamsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Teams", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/teams") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TeamsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TeamEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TeamEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List all teams -// List all of the teams in the organization -func (s *Teams) List(ctx context.Context, request operations.GetV1TeamsRequest, opts ...operations.Option) (*operations.GetV1TeamsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Teams", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/teams") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TeamEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TeamEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Archive a team -// Archives an team which will hide it from lists and metrics -func (s *Teams) Archive(ctx context.Context, request operations.DeleteV1TeamsTeamIDRequest, opts ...operations.Option) (*operations.DeleteV1TeamsTeamIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TeamsTeamId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TeamsTeamIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TeamEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TeamEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a team -// Update a single team from its ID -func (s *Teams) Update(ctx context.Context, request operations.PatchV1TeamsTeamIDRequest, opts ...operations.Option) (*operations.PatchV1TeamsTeamIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TeamsTeamId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1TeamsTeamID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TeamsTeamIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TeamEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TeamEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a team -// Retrieve a single team from its ID -func (s *Teams) Get(ctx context.Context, request operations.GetV1TeamsTeamIDRequest, opts ...operations.Option) (*operations.GetV1TeamsTeamIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TeamsTeamId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsTeamIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TeamEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TeamEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateEscalationPolicy - Create an escalation policy -// Create a Signals escalation policy for a team. -func (s *Teams) CreateEscalationPolicy(ctx context.Context, request operations.PostV1TeamsTeamIDEscalationPoliciesRequest, opts ...operations.Option) (*operations.PostV1TeamsTeamIDEscalationPoliciesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TeamsTeamIdEscalationPolicies", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/escalation_policies", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1TeamsTeamIDEscalationPolicies", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TeamsTeamIDEscalationPoliciesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListEscalationPolicies - List escalation policies -// List all Signals escalation policies for a team. -func (s *Teams) ListEscalationPolicies(ctx context.Context, request operations.GetV1TeamsTeamIDEscalationPoliciesRequest, opts ...operations.Option) (*operations.GetV1TeamsTeamIDEscalationPoliciesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TeamsTeamIdEscalationPolicies", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/escalation_policies", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsTeamIDEscalationPoliciesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteEscalationPolicy - Delete an escalation policy -// Delete a Signals escalation policy by ID -func (s *Teams) DeleteEscalationPolicy(ctx context.Context, request operations.DeleteV1TeamsTeamIDEscalationPoliciesIDRequest, opts ...operations.Option) (*operations.DeleteV1TeamsTeamIDEscalationPoliciesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TeamsTeamIdEscalationPoliciesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/escalation_policies/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TeamsTeamIDEscalationPoliciesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetEscalationPolicy - Get an escalation policy -// Get a Signals escalation policy by ID -func (s *Teams) GetEscalationPolicy(ctx context.Context, request operations.GetV1TeamsTeamIDEscalationPoliciesIDRequest, opts ...operations.Option) (*operations.GetV1TeamsTeamIDEscalationPoliciesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TeamsTeamIdEscalationPoliciesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/escalation_policies/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsTeamIDEscalationPoliciesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListOnCallSchedules - List on-call schedules -// List all Signals on-call schedules for a team. -func (s *Teams) ListOnCallSchedules(ctx context.Context, request operations.GetV1TeamsTeamIDOnCallSchedulesRequest, opts ...operations.Option) (*operations.GetV1TeamsTeamIDOnCallSchedulesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TeamsTeamIdOnCallSchedules", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsTeamIDOnCallSchedulesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteOnCallSchedule - Delete an on-call schedule -// Delete a Signals on-call schedule by ID -func (s *Teams) DeleteOnCallSchedule(ctx context.Context, request operations.DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDRequest, opts ...operations.Option) (*operations.DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TeamsTeamIdOnCallSchedulesScheduleId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules/{schedule_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateOnCallSchedule - Update an on-call schedule -// Update a Signals on-call schedule by ID -func (s *Teams) UpdateOnCallSchedule(ctx context.Context, request operations.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDRequest, opts ...operations.Option) (*operations.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TeamsTeamIdOnCallSchedulesScheduleId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules/{schedule_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1TeamsTeamIDOnCallSchedulesScheduleID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateOnCallShift - Create an on-call shift -// Create a Signals on-call shift in a schedule. -func (s *Teams) CreateOnCallShift(ctx context.Context, request operations.PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsRequest, opts ...operations.Option) (*operations.PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TeamsTeamIdOnCallSchedulesScheduleIdShifts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules/{schedule_id}/shifts", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PostV1TeamsTeamIDOnCallSchedulesScheduleIDShifts", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteOnCallShift - Delete an on-call shift -// Delete a Signals on-call shift by ID -func (s *Teams) DeleteOnCallShift(ctx context.Context, request operations.DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest, opts ...operations.Option) (*operations.DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TeamsTeamIdOnCallSchedulesScheduleIdShiftsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules/{schedule_id}/shifts/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateShift - Update an on-call shift -// Update a Signals on-call shift by ID -func (s *Teams) UpdateShift(ctx context.Context, request operations.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest, opts ...operations.Option) (*operations.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TeamsTeamIdOnCallSchedulesScheduleIdShiftsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules/{schedule_id}/shifts/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetOnCallShift - Get an on-call shift -// Get a Signals on-call shift by ID -func (s *Teams) GetOnCallShift(ctx context.Context, request operations.GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDRequest, opts ...operations.Option) (*operations.GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TeamsTeamIdOnCallSchedulesScheduleIdShiftsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/on_call_schedules/{schedule_id}/shifts/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsTeamIDOnCallSchedulesScheduleIDShiftsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetSignalRules - List Signals rules -// List all Signals rules for a team. -func (s *Teams) GetSignalRules(ctx context.Context, request operations.GetV1TeamsTeamIDSignalRulesRequest, opts ...operations.Option) (*operations.GetV1TeamsTeamIDSignalRulesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TeamsTeamIdSignalRules", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/signal_rules", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TeamsTeamIDSignalRulesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateSignalRule - Update a Signals rule -// Update a Signals rule by ID -func (s *Teams) UpdateSignalRule(ctx context.Context, request operations.PatchV1TeamsTeamIDSignalRulesIDRequest, opts ...operations.Option) (*operations.PatchV1TeamsTeamIDSignalRulesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TeamsTeamIdSignalRulesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/teams/{team_id}/signal_rules/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1TeamsTeamIDSignalRulesID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TeamsTeamIDSignalRulesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/ticketing.go b/internal/sdk/ticketing.go deleted file mode 100644 index 4fc31a8..0000000 --- a/internal/sdk/ticketing.go +++ /dev/null @@ -1,2354 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Ticketing - Operations about ticketings -type Ticketing struct { - Projects *Projects - Priorities *FirehydrantPriorities - - sdkConfiguration sdkConfiguration -} - -func newTicketing(sdkConfig sdkConfiguration) *Ticketing { - return &Ticketing{ - sdkConfiguration: sdkConfig, - Projects: newProjects(sdkConfig), - Priorities: newFirehydrantPriorities(sdkConfig), - } -} - -// CreateTicket - Create a ticket -// Creates a ticket for a project -func (s *Ticketing) CreateTicket(ctx context.Context, request shared.PostV1TicketingTickets, opts ...operations.Option) (*operations.PostV1TicketingTicketsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TicketingTickets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ticketing/tickets") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TicketingTicketsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingTicketEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingTicketEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListTickets - List all tickets -// List all of the tickets that have been added to the organiation -func (s *Ticketing) ListTickets(ctx context.Context, request operations.GetV1TicketingTicketsRequest, opts ...operations.Option) (*operations.GetV1TicketingTicketsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingTickets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ticketing/tickets") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingTicketsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingTicketEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingTicketEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Ticketing) DeleteTicket(ctx context.Context, request operations.DeleteV1TicketingTicketsTicketIDRequest, opts ...operations.Option) (*operations.DeleteV1TicketingTicketsTicketIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TicketingTicketsTicketId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/tickets/{ticket_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TicketingTicketsTicketIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// PatchTicket - Update a ticket -// Update a ticket's attributes -func (s *Ticketing) PatchTicket(ctx context.Context, request operations.PatchV1TicketingTicketsTicketIDRequest, opts ...operations.Option) (*operations.PatchV1TicketingTicketsTicketIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TicketingTicketsTicketId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/tickets/{ticket_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1TicketingTicketsTicketID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TicketingTicketsTicketIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingTicketEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingTicketEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetTicket - Retrieve a single ticket -// Retrieves a single ticket by ID -func (s *Ticketing) GetTicket(ctx context.Context, request operations.GetV1TicketingTicketsTicketIDRequest, opts ...operations.Option) (*operations.GetV1TicketingTicketsTicketIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingTicketsTicketId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/tickets/{ticket_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingTicketsTicketIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingTicketEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingTicketEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Ticketing) GetConfigOptions(ctx context.Context, request operations.GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsRequest, opts ...operations.Option) (*operations.GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingProjectsTicketingProjectIdConfigurationOptions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/configuration_options", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetAvailableFields - Get the fields that can be mapped for this project. -// Returns metadata for the fields that are available for field mapping. -func (s *Ticketing) GetAvailableFields(ctx context.Context, request operations.GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsRequest, opts ...operations.Option) (*operations.GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingProjectsTicketingProjectIdFieldMapsAvailableFields", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/field_maps/available_fields", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingProjectsTicketingProjectIDFieldMapsAvailableFieldsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingFieldMapsMappableFieldEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingFieldMapsMappableFieldEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateFieldMap - Create field map for a ticketing project -// Creates field map for a ticketing project -func (s *Ticketing) CreateFieldMap(ctx context.Context, request operations.PostV1TicketingProjectsTicketingProjectIDFieldMapsRequest, opts ...operations.Option) (*operations.PostV1TicketingProjectsTicketingProjectIDFieldMapsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TicketingProjectsTicketingProjectIdFieldMaps", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/field_maps", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TicketingProjectsTicketingProjectIDFieldMapsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectFieldMapEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectFieldMapEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteFieldMap - Archive field map for a ticketing project -// Archive field map for a ticketing project -func (s *Ticketing) DeleteFieldMap(ctx context.Context, request operations.DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest, opts ...operations.Option) (*operations.DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TicketingProjectsTicketingProjectIdFieldMapsMapId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/field_maps/{map_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetFieldMap - Retrieve field map for a ticketing project -// Retrieve field map for a ticketing project -func (s *Ticketing) GetFieldMap(ctx context.Context, request operations.GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest, opts ...operations.Option) (*operations.GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingProjectsTicketingProjectIdFieldMapsMapId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/field_maps/{map_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectFieldMapEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectFieldMapEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateFieldMap - Update field map for a ticketing project -// Update field map for a ticketing project -func (s *Ticketing) UpdateFieldMap(ctx context.Context, request operations.PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDRequest, opts ...operations.Option) (*operations.PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TicketingProjectsTicketingProjectIdFieldMapsMapId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/field_maps/{map_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TicketingProjectsTicketingProjectIDFieldMapsMapIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectFieldMapEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectFieldMapEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreateProviderProjectConfiguration - Create configuration for a ticketing project -// Creates configuration for a ticketing project -func (s *Ticketing) CreateProviderProjectConfiguration(ctx context.Context, request operations.PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsRequest, opts ...operations.Option) (*operations.PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TicketingProjectsTicketingProjectIdProviderProjectConfigurations", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/provider_project_configurations", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectConfigEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectConfigEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ArchiveProjectConfiguration - Archive configuration for a ticketing project -// Archive configuration for a ticketing project -func (s *Ticketing) ArchiveProjectConfiguration(ctx context.Context, request operations.DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest, opts ...operations.Option) (*operations.DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TicketingProjectsTicketingProjectIdProviderProjectConfigurationsConfigId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/provider_project_configurations/{config_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectConfigEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectConfigEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// UpdateProjectConfiguration - Update configuration for a ticketing project -// Update configuration for a ticketing project -func (s *Ticketing) UpdateProjectConfiguration(ctx context.Context, request operations.PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest, opts ...operations.Option) (*operations.PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1TicketingProjectsTicketingProjectIdProviderProjectConfigurationsConfigId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/provider_project_configurations/{config_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectConfigEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectConfigEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetProviderProjectConfiguration - Retrieve configuration for a ticketing project -// Retrieve configuration for a ticketing project -func (s *Ticketing) GetProviderProjectConfiguration(ctx context.Context, request operations.GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDRequest, opts ...operations.Option) (*operations.GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingProjectsTicketingProjectIdProviderProjectConfigurationsConfigId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/projects/{ticketing_project_id}/provider_project_configurations/{config_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingProjectsTicketingProjectIDProviderProjectConfigurationsConfigIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingProjectConfigEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingProjectConfigEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// CreatePriority - Create a ticketing priority -// Create a single ticketing priority -func (s *Ticketing) CreatePriority(ctx context.Context, request shared.PostV1TicketingPriorities, opts ...operations.Option) (*operations.PostV1TicketingPrioritiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1TicketingPriorities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ticketing/priorities") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1TicketingPrioritiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingPriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingPriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListPriorities - List all ticketing priorities -// List all ticketing priorities available to the organization -func (s *Ticketing) ListPriorities(ctx context.Context, opts ...operations.Option) (*operations.GetV1TicketingPrioritiesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingPriorities", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ticketing/priorities") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingPrioritiesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingPriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingPriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeletePriority - Delete a ticketing priority -// Delete a single ticketing priority by ID -func (s *Ticketing) DeletePriority(ctx context.Context, request operations.DeleteV1TicketingPrioritiesIDRequest, opts ...operations.Option) (*operations.DeleteV1TicketingPrioritiesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1TicketingPrioritiesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/priorities/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1TicketingPrioritiesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingPriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingPriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetPriority - Retrieve a ticketing priority -// Retrieve a single ticketing priority by ID -func (s *Ticketing) GetPriority(ctx context.Context, request operations.GetV1TicketingPrioritiesIDRequest, opts ...operations.Option) (*operations.GetV1TicketingPrioritiesIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingPrioritiesId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/ticketing/priorities/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingPrioritiesIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TicketingPriorityEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TicketingPriorityEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// ListTags - List all ticket tags -// List all of the ticket tags in the organization -func (s *Ticketing) ListTags(ctx context.Context, request operations.GetV1TicketingTicketTagsRequest, opts ...operations.Option) (*operations.GetV1TicketingTicketTagsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1TicketingTicketTags", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/ticketing/ticket_tags") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1TicketingTicketTagsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.TagEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TagEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/types/bigint.go b/internal/sdk/types/bigint.go deleted file mode 100644 index 9c6a086..0000000 --- a/internal/sdk/types/bigint.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import ( - "fmt" - "math/big" -) - -// MustNewBigIntFromString returns an instance of big.Int from a string -// The string is assumed to be base 10 and if it is not a valid big.Int -// then the function panics. -// Avoid using this function in production code. -func MustNewBigIntFromString(s string) *big.Int { - i, ok := new(big.Int).SetString(s, 10) - if !ok { - panic(fmt.Errorf("failed to parse string as big.Int")) - } - - return i -} diff --git a/internal/sdk/types/date.go b/internal/sdk/types/date.go deleted file mode 100644 index 5b2782f..0000000 --- a/internal/sdk/types/date.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import ( - "encoding/json" - "fmt" - "strings" - "time" -) - -// Date is a wrapper around time.Time that allows for JSON marshaling a date string formatted as "2006-01-02". -type Date struct { - time.Time -} - -var ( - _ json.Marshaler = &Date{} - _ json.Unmarshaler = &Date{} - _ fmt.Stringer = &Date{} -) - -// NewDate returns an instance of Date from a time.Time. -func NewDate(t time.Time) *Date { - d := DateFromTime(t) - return &d -} - -// DateFromTime returns a Date from a time.Time. -func DateFromTime(t time.Time) Date { - return Date{t} -} - -// NewDateFromString returns an instance of Date from a string formatted as "2006-01-02". -func NewDateFromString(str string) (*Date, error) { - d, err := DateFromString(str) - if err != nil { - return nil, err - } - - return &d, nil -} - -// DateFromString returns a Date from a string formatted as "2006-01-02". -func DateFromString(str string) (Date, error) { - var d Date - var err error - - d.Time, err = time.Parse("2006-01-02", str) - return d, err -} - -// MustNewDateFromString returns an instance of Date from a string formatted as "2006-01-02" or panics. -// Avoid using this function in production code. -func MustNewDateFromString(str string) *Date { - d := MustDateFromString(str) - return &d -} - -// MustDateFromString returns a Date from a string formatted as "2006-01-02" or panics. -// Avoid using this function in production code. -func MustDateFromString(str string) Date { - d, err := DateFromString(str) - if err != nil { - panic(err) - } - return d -} - -func (d Date) GetTime() time.Time { - return d.Time -} - -func (d Date) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(`"%s"`, d.Time.Format("2006-01-02"))), nil -} - -func (d *Date) UnmarshalJSON(data []byte) error { - var err error - - str := string(data) - str = strings.Trim(str, `"`) - - d.Time, err = time.Parse("2006-01-02", str) - return err -} - -func (d Date) String() string { - return d.Time.Format("2006-01-02") -} diff --git a/internal/sdk/types/datetime.go b/internal/sdk/types/datetime.go deleted file mode 100644 index 3eff332..0000000 --- a/internal/sdk/types/datetime.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "time" - -// MustTimeFromString returns a time.Time from a string formatted as "2006-01-02T15:04:05Z07:00" or panics. -// Avoid using this function in production code. -func MustTimeFromString(str string) time.Time { - t, err := time.Parse(time.RFC3339, str) - if err != nil { - panic(err) - } - - return t -} - -// MustNewTimeFromString returns an instance of time.Time from a string formatted as "2006-01-02T15:04:05Z07:00" or panics. -// Avoid using this function in production code. -func MustNewTimeFromString(str string) *time.Time { - t := MustTimeFromString(str) - return &t -} diff --git a/internal/sdk/types/decimal.go b/internal/sdk/types/decimal.go deleted file mode 100644 index d8429bc..0000000 --- a/internal/sdk/types/decimal.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import ( - "fmt" - - "github.com/ericlagergren/decimal" -) - -// MustNewDecimalFromString returns an instance of Decimal from a string -// Avoid using this function in production code. -func MustNewDecimalFromString(s string) *decimal.Big { - d, ok := new(decimal.Big).SetString(s) - if !ok { - panic(fmt.Errorf("failed to parse string as decimal.Big")) - } - - return d -} diff --git a/internal/sdk/types/pointers.go b/internal/sdk/types/pointers.go deleted file mode 100644 index 35c439d..0000000 --- a/internal/sdk/types/pointers.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -func String(s string) *string { return &s } -func Bool(b bool) *bool { return &b } -func Int(i int) *int { return &i } -func Int64(i int64) *int64 { return &i } -func Float32(f float32) *float32 { return &f } -func Float64(f float64) *float64 { return &f } -func Pointer[T any](v T) *T { return &v } diff --git a/internal/sdk/users.go b/internal/sdk/users.go deleted file mode 100644 index 7ba5b1c..0000000 --- a/internal/sdk/users.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Users - Operations about users -type Users struct { - sdkConfiguration sdkConfiguration -} - -func newUsers(sdkConfig sdkConfiguration) *Users { - return &Users{ - sdkConfiguration: sdkConfig, - } -} - -// List users -// Retrieve a list of all users in an organization -func (s *Users) List(ctx context.Context, request operations.GetV1UsersRequest, opts ...operations.Option) (*operations.GetV1UsersResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Users", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/users") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1UsersResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.UserEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.UserEntityPaginated = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// GetServices - Retrieves a list of services owned by the teams a user is on -// Retrieves a list of services owned by the teams a user is on -func (s *Users) GetServices(ctx context.Context, request operations.GetV1UsersIDServicesRequest, opts ...operations.Option) (*operations.GetV1UsersIDServicesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1UsersIdServices", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/users/{id}/services", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1UsersIDServicesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out []shared.TeamEntityPaginated - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.TeamEntityPaginateds = out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/webhooks.go b/internal/sdk/webhooks.go deleted file mode 100644 index eb20547..0000000 --- a/internal/sdk/webhooks.go +++ /dev/null @@ -1,709 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -// Webhooks - Operations about webhooks -type Webhooks struct { - sdkConfiguration sdkConfiguration -} - -func newWebhooks(sdkConfig sdkConfiguration) *Webhooks { - return &Webhooks{ - sdkConfiguration: sdkConfig, - } -} - -// Create webhook -// Create a new webhook -func (s *Webhooks) Create(ctx context.Context, request shared.PostV1Webhooks, opts ...operations.Option) (*operations.PostV1WebhooksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1Webhooks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/webhooks") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1WebhooksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.WebhooksEntitiesWebhookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.WebhooksEntitiesWebhookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List - Lists webhooks -// Lists webhooks -func (s *Webhooks) List(ctx context.Context, request operations.GetV1WebhooksRequest, opts ...operations.Option) (*operations.GetV1WebhooksResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1Webhooks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/webhooks") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1WebhooksResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.WebhooksEntitiesWebhookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.WebhooksEntitiesWebhookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -func (s *Webhooks) ListDeliveries(ctx context.Context, request operations.GetV1WebhooksWebhookIDDeliveriesRequest, opts ...operations.Option) (*operations.GetV1WebhooksWebhookIDDeliveriesResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1WebhooksWebhookIdDeliveries", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/webhooks/{webhook_id}/deliveries", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1WebhooksWebhookIDDeliveriesResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Delete a specific webhook -// Delete a specific webhook -func (s *Webhooks) Delete(ctx context.Context, request operations.DeleteV1WebhooksWebhookIDRequest, opts ...operations.Option) (*operations.DeleteV1WebhooksWebhookIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "deleteV1WebhooksWebhookId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/webhooks/{webhook_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.DeleteV1WebhooksWebhookIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update a specific webhook -// Update a specific webhook -func (s *Webhooks) Update(ctx context.Context, request operations.PatchV1WebhooksWebhookIDRequest, opts ...operations.Option) (*operations.PatchV1WebhooksWebhookIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1WebhooksWebhookId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/webhooks/{webhook_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1WebhooksWebhookID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1WebhooksWebhookIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.WebhooksEntitiesWebhookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.WebhooksEntitiesWebhookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Get - Retrieve a specific webhook -// Retrieve a specific webhook -func (s *Webhooks) Get(ctx context.Context, request operations.GetV1WebhooksWebhookIDRequest, opts ...operations.Option) (*operations.GetV1WebhooksWebhookIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1WebhooksWebhookId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/webhooks/{webhook_id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1WebhooksWebhookIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.WebhooksEntitiesWebhookEntity - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.WebhooksEntitiesWebhookEntity = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/internal/sdk/webhooktargets.go b/internal/sdk/webhooktargets.go deleted file mode 100644 index 52b216e..0000000 --- a/internal/sdk/webhooktargets.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdk - -import ( - "bytes" - "context" - "fmt" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/hooks" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/internal/utils" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/errors" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/operations" - "github.com/firehydrant/terraform-provider-firehydrant/internal/sdk/models/shared" - "net/http" - "net/url" -) - -type WebhookTargets struct { - sdkConfiguration sdkConfiguration -} - -func newWebhookTargets(sdkConfig sdkConfiguration) *WebhookTargets { - return &WebhookTargets{ - sdkConfiguration: sdkConfig, - } -} - -// Post - Create an webhook target -// Create a Signals webhook target. -func (s *WebhookTargets) Post(ctx context.Context, request shared.PostV1SignalsWebhookTargets, opts ...operations.Option) (*operations.PostV1SignalsWebhookTargetsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "postV1SignalsWebhookTargets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/webhook_targets") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PostV1SignalsWebhookTargetsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out operations.PostV1SignalsWebhookTargetsResponseBody - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.Object = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// List webhook targets -// List all Signals webhook targets. -func (s *WebhookTargets) List(ctx context.Context, request operations.GetV1SignalsWebhookTargetsRequest, opts ...operations.Option) (*operations.GetV1SignalsWebhookTargetsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "getV1SignalsWebhookTargets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/v1/signals/webhook_targets") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetV1SignalsWebhookTargetsResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// Update an webhook target -// Update a Signals webhook target by ID -func (s *WebhookTargets) Update(ctx context.Context, request operations.PatchV1SignalsWebhookTargetsIDRequest, opts ...operations.Option) (*operations.PatchV1SignalsWebhookTargetsIDResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "patchV1SignalsWebhookTargetsId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/signals/webhook_targets/{id}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchV1SignalsWebhookTargetsID", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "*/*") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.PatchV1SignalsWebhookTargetsIDResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/scripts/Readme.md b/scripts/Readme.md new file mode 100644 index 0000000..07a3b59 --- /dev/null +++ b/scripts/Readme.md @@ -0,0 +1,226 @@ +# OpenAPI to Terraform Provider Pipeline Scripts + +This directory contains scripts for processing OpenAPI specifications to generate Terraform providers using Speakeasy. + +## Overview + +Our pipeline consists of two main phases: +1. **Normalization**: Deep structure alignment between request/response schemas with reference resolution +2. **Overlay Generation**: Creates Speakeasy annotations for Terraform provider generation with granular readonly marking + +## Workflow + +```mermaid + A[openapi-raw.json] -->|normalize| B[openapi.json] + B -->|overlay| C[terraform-overlay.yaml] + C -->|speakeasy| D[Terraform Provider] +``` +Note: we point to the openapi3 spec in our Developers repo to ensure an up-to-date generation + +## Scripts + +### `normalize` +Normalizes an OpenAPI specification to ensure compatibility with Terraform provider generation through deep structure analysis. + +**Usage:** +```bash +go run ./scripts/normalize [output.json] +``` + +**What it does:** +- Identifies entity schemas and their corresponding create/update schemas +- Adds missing required fields from request schemas to entity schemas +- Aligns property structures between request and response schemas +- Converts `additionalProperties` to `properties` for better Terraform compatibility +- Normalizes path parameters (e.g., converts integer IDs to strings) +- Converts enums to speakeasy-compatible x-speakeasy-enums structures + +### `overlay` +Generates a Speakeasy overlay file with the necessary annotations for Terraform provider generation. + +**Usage:** +```bash +go run ./scripts/overlay [manual-mappings.yaml] +``` + +**What it does:** +- Identifies viable Terraform resources (must have at least CREATE and READ operations) +- Adds `x-speakeasy-entity` annotations to entity schemas +- Maps CRUD operations using `x-speakeasy-entity-operation` +- Detects properties normalized during the normalize phase +- Marks response-only fields with `x-speakeasy-param-readonly` instead of ignoring +- Handles nested readonly properties within manageable fields +- Only uses `x-speakeasy-ignore` for truly incompatible properties +- Applies manual mappings for edge cases + +See speakeasy extensions: https://www.speakeasy.com/docs/speakeasy-reference/extensions +## Key Concepts + +1. **During Normalization**: + - Deep structure alignment ensures compatibility + - Required fields missing from entity schemas are automatically added + - Added fields are marked as `nullable: true` since they might not be returned by the API + +2. **During Overlay Generation**: + - Required fields are never marked with `x-speakeasy-ignore` + - If issues persist, we use `x-speakeasy-param-optional` instead + - Computed fields use `x-speakeasy-param-readonly` + +### Entity Identification + +Entities are identified by: +- Schema name ending with `Entity` +- Contains an `id` or `slug` property +- Has associated create/update schemas (e.g., `UserEntity` → `create_user`, `update_user`) + +### Resource Viability + +A resource is considered viable for Terraform if it has: +- At least CREATE and READ operations +- A valid create schema +- Identifiable primary ID parameter +- Sufficient overlap between create and entity schemas after normalization + +## Manual Mappings + +The `manual-mappings.yaml` file allows for handling edge cases: + +```yaml +operations: + - path: /api/v1/special/resource + method: post + action: entity + value: SpecialResourceEntity + + - path: /api/v1/problematic + method: get + action: ignore + + - path: /api/v1/resource/{resource_id} + method: get + action: match + value: "resource_id:id" + +properties: + - schema: SomeEntity + property: problematic_field + action: ignore_property +``` + +## Example + +Given this input structure with nested objects and references: +```json +{ + "components": { + "schemas": { + "create_user": { + "properties": { + "name": { "type": "string" }, + "email": { "type": "string" }, + "settings": { + "type": "object", + "properties": { + "theme": { "type": "string" }, + "notifications": { "type": "boolean" } + } + } + }, + "required": ["name", "email"] + }, + "UserEntity": { + "properties": { + "id": { "type": "string" }, + "name": { "type": "string" }, + "email": { "type": "string" }, + "settings": { "$ref": "#/components/schemas/UserSettings" }, + "created_at": { "type": "string" } + } + }, + "UserSettings": { + "properties": { + "theme": { "type": "string" }, + "notifications": { "type": "boolean" }, + "last_login": { "type": "string" } // computed field + } + } + } + } +} +``` + +The normalization process will: +1. Detect that `settings` structures are semantically equivalent +2. Align the response structure to match the request structure +3. Preserve computed fields like `last_login` + +The overlay generation will: +1. Mark `UserEntity` with `x-speakeasy-entity` +2. Map CRUD operations +3. Mark `created_at` as `x-speakeasy-param-readonly` +4. Mark `settings.last_login` as `x-speakeasy-param-readonly` +5. Keep `settings.theme` and `settings.notifications` manageable + +## Script Debugging + +Run scripts locally. Use `speakeasy run` to attempt to generate the provider. + +### Debugging Normalization +- Look for fields that were added from request schemas +- Verify that complex structures were properly aligned + +### Debugging Overlay +- Check for `x-speakeasy-param-readonly` vs `x-speakeasy-ignore` usage +- Verify that normalized properties weren't incorrectly ignored +- Look for nested readonly properties within manageable fields + +To view the combined normalized spec + overlay run `speakeasy overlay apply -s {specPath} -o {overlayPath} > {outputPath}` This output will always be in yaml, so name accordingly + +Lint the spec with `speakeasy openapi`, select lint and follow prompts + +To focus on a sub-section of the spec: +Collect the operationIds that encompass your desired scope, e.g. create_incident,get_incident,delete_incident +Run `speakeasy openapi` and select transform, continue past prompts until you see `transform remove-unused` or `schema to transform` prompt. Enter the operationIds, follow prompts. A smaller version of the spec will be created for testing/debugging. + +## Integration + +This pipeline is typically run as part of a GitHub Action: + +```yaml +- name: Process OpenAPI spec + run: | + go run ./scripts/normalize openapi-raw.json openapi.json + go run ./scripts/overlay openapi.json ./scripts/overlay/manual-mappings.yaml + mkdir -p .speakeasy + mv terraform-overlay.yaml .speakeasy/ +``` + +The generated overlay is then used by Speakeasy to create the Terraform provider. + +## Provider Local Testing + +After `speakeasy run` has successfully completed. +Add dev.tfrc to directory root (this sometimes needs to be named .terraformrc) +``` +provider_installation { + dev_overrides { + "registry.terraform.io/firehydrant/firehydrant" = "/Users/jonahstewart/Developer/terraform-provider-firehydrant-v2" + } + + # For all other providers, install them directly from their origin provider + # registries as normal. If you omit this, Terraform will _only_ use + # the dev_overrides block, and so no other providers will be available. + direct {} +} +``` +This will tell terraform to use your local build instead of downloading the latest published version + +Add a test.tf terraform config to the root directory for your chosen resource testing, Can be modeled after the corresponding entity file in docs>resources, which will be generated with `speakeasy run`. + +add terraform.tfvars to directory root with: +``` +api_key = {staging apikey} +``` + +Run `go build -o terraform-provider-firehydrant` so you have a local binary to use +after that you can terraform init, plan, apply, destroy etc to test against staging \ No newline at end of file diff --git a/scripts/common/schema-utils.go b/scripts/common/schema-utils.go new file mode 100644 index 0000000..5430c39 --- /dev/null +++ b/scripts/common/schema-utils.go @@ -0,0 +1,95 @@ +package common + +import ( + "strings" +) + +// ResolveRef follows a $ref to get the actual schema +func ResolveRef(ref string, schemas map[string]interface{}) (map[string]interface{}, string) { + if ref == "" { + return nil, "" + } + + parts := strings.Split(ref, "/") + if len(parts) == 0 { + return nil, "" + } + + schemaName := parts[len(parts)-1] + if schema, ok := schemas[schemaName].(map[string]interface{}); ok { + // Handle nullable wrappers (e.g., NullableXXX schemas that use allOf) + if allOf, hasAllOf := schema["allOf"].([]interface{}); hasAllOf && len(allOf) > 0 { + if refMap, ok := allOf[0].(map[string]interface{}); ok { + if innerRef, ok := refMap["$ref"].(string); ok { + return ResolveRef(innerRef, schemas) + } + } + } + return schema, schemaName + } + + return nil, "" +} + +// GetResolvedPropertyType gets the actual type of a property, following refs if needed +func GetResolvedPropertyType(prop interface{}, schemas map[string]interface{}) (map[string]interface{}, string) { + propMap, ok := prop.(map[string]interface{}) + if !ok { + return nil, "unknown" + } + + // If it's a ref, resolve it + if ref, hasRef := propMap["$ref"].(string); hasRef { + resolved, _ := ResolveRef(ref, schemas) + if resolved != nil { + return resolved, "ref" + } + } + + return propMap, "inline" +} + +// ComparePropertyStructures does a deep comparison of two property structures +func ComparePropertyStructures(entityProp, requestProp interface{}, schemas map[string]interface{}) bool { + entityResolved, _ := GetResolvedPropertyType(entityProp, schemas) + requestResolved, _ := GetResolvedPropertyType(requestProp, schemas) + + if entityResolved == nil || requestResolved == nil { + return false + } + + // Compare types + entityType, _ := entityResolved["type"].(string) + requestType, _ := requestResolved["type"].(string) + + if entityType != requestType { + return false + } + + // For objects, recursively compare properties + if entityType == "object" { + entityProps, _ := entityResolved["properties"].(map[string]interface{}) + requestProps, _ := requestResolved["properties"].(map[string]interface{}) + + // Check if request properties exist in entity (one-way check) + for propName, requestSubProp := range requestProps { + if entitySubProp, exists := entityProps[propName]; exists { + if !ComparePropertyStructures(entitySubProp, requestSubProp, schemas) { + return false + } + } else { + return false + } + } + return true + } + + // For arrays, compare item types + if entityType == "array" { + entityItems := entityResolved["items"] + requestItems := requestResolved["items"] + return ComparePropertyStructures(entityItems, requestItems, schemas) + } + + return true +} diff --git a/scripts/normalize/enums.go b/scripts/normalize/enums.go new file mode 100644 index 0000000..0acf595 --- /dev/null +++ b/scripts/normalize/enums.go @@ -0,0 +1,373 @@ +package main + +import ( + "fmt" + "strings" + "unicode" +) + +type EnumNormalizationInfo struct { + SchemaName string + PropertyPath string + PropertyName string + EnumValues []string + Target map[string]interface{} +} + +func normalizeEnums(schemas map[string]interface{}) []ConflictDetail { + conflicts := make([]ConflictDetail, 0) + + fmt.Printf("\n=== Normalizing Enum Properties ===\n") + + allEnums := findAllEnumProperties(schemas) + + if len(allEnums) == 0 { + fmt.Printf("No enum properties found to normalize\n") + return conflicts + } + + fmt.Printf("Found %d enum properties to normalize\n", len(allEnums)) + + for _, enumInfo := range allEnums { + conflict := transformEnumProperty(enumInfo) + if conflict != nil { + conflicts = append(conflicts, *conflict) + } + } + + fmt.Printf("Successfully normalized %d enum properties\n", len(conflicts)) + return conflicts +} + +func findAllEnumProperties(schemas map[string]interface{}) []EnumNormalizationInfo { + var allEnums []EnumNormalizationInfo + + for schemaName, schema := range schemas { + schemaMap, ok := schema.(map[string]interface{}) + if !ok { + continue + } + + schemaEnums := findEnumsInSchemaRecursive(schemaName, schemaMap, "", schemaMap) + allEnums = append(allEnums, schemaEnums...) + } + + return allEnums +} + +func findEnumsInSchemaRecursive(schemaName string, currentObj map[string]interface{}, path string, rootSchema map[string]interface{}) []EnumNormalizationInfo { + var enums []EnumNormalizationInfo + + if enumValues, hasEnum := currentObj["enum"]; hasEnum { + if enumArray, ok := enumValues.([]interface{}); ok && len(enumArray) > 0 { + var stringValues []string + for _, val := range enumArray { + if str, ok := val.(string); ok { + stringValues = append(stringValues, str) + } + } + + if len(stringValues) > 0 { + propertyName := extractPropertyNameFromNormalizationPath(path, schemaName) + + enumInfo := EnumNormalizationInfo{ + SchemaName: schemaName, + PropertyPath: path, + PropertyName: propertyName, + EnumValues: stringValues, + Target: currentObj, + } + + enums = append(enums, enumInfo) + } + } + } + + if properties, hasProps := currentObj["properties"].(map[string]interface{}); hasProps { + for propName, propValue := range properties { + if propMap, ok := propValue.(map[string]interface{}); ok { + newPath := propName + if path != "" { + newPath = fmt.Sprintf("%s.properties.%s", path, propName) + } else { + newPath = fmt.Sprintf("properties.%s", propName) + } + + propEnums := findEnumsInSchemaRecursive(schemaName, propMap, newPath, rootSchema) + enums = append(enums, propEnums...) + } + } + } + + if items, hasItems := currentObj["items"].(map[string]interface{}); hasItems { + newPath := path + if path != "" { + newPath = fmt.Sprintf("%s.items", path) + } else { + newPath = "items" + } + + itemEnums := findEnumsInSchemaRecursive(schemaName, items, newPath, rootSchema) + enums = append(enums, itemEnums...) + } + + return enums +} + +func transformEnumProperty(enumInfo EnumNormalizationInfo) *ConflictDetail { + var members []map[string]interface{} + + for _, value := range enumInfo.EnumValues { + memberName := generateEnumMemberName(value, enumInfo.PropertyName, enumInfo.SchemaName) + members = append(members, map[string]interface{}{ + "name": memberName, + "value": value, + }) + } + + delete(enumInfo.Target, "enum") + enumInfo.Target["x-speakeasy-enums"] = members + + targetPath := enumInfo.SchemaName + if enumInfo.PropertyPath != "" { + targetPath = fmt.Sprintf("%s.%s", enumInfo.SchemaName, enumInfo.PropertyPath) + } + + return &ConflictDetail{ + Schema: enumInfo.SchemaName, + Property: enumInfo.PropertyName, + ConflictType: "enum-normalization", + Resolution: fmt.Sprintf("Replaced enum array with x-speakeasy-enums at %s (%d values)", targetPath, len(members)), + } +} + +func generateEnumMemberName(value, fieldName, entityName string) string { + if strings.TrimSpace(value) == "" { + value = "Empty" + } + + var prefix string + + switch { + case entityName == "RequestParam": + prefix = "Request" + case entityName == "RequestBody": + if strings.HasPrefix(fieldName, "Form") { + prefix = "" // Form prefix is already in fieldName + } else { + prefix = "Request" + } + case entityName == "Response": + prefix = "Response" + case strings.HasSuffix(entityName, "Entity"): + prefix = convertToEnumMemberName(strings.TrimSuffix(entityName, "Entity")) + default: + prefix = convertToEnumMemberName(entityName) + } + + cleanFieldName := convertToEnumMemberName(fieldName) + cleanValue := convertToEnumMemberName(value) + + memberName := prefix + cleanFieldName + cleanValue + + // Ensure it starts with a letter + if len(memberName) > 0 && unicode.IsDigit(rune(memberName[0])) { + memberName = "Value" + memberName + } + + if memberName == "" { + memberName = prefix + cleanFieldName + "Unknown" + } + + return memberName +} + +func extractPropertyNameFromNormalizationPath(path, schemaName string) string { + if path == "" { + return strings.TrimSuffix(schemaName, "Entity") + } + + parts := strings.Split(path, ".") + + for i := len(parts) - 1; i >= 0; i-- { + part := parts[i] + + if part == "properties" || part == "items" { + continue + } + + return part + } + + return strings.TrimSuffix(schemaName, "Entity") +} + +func convertToEnumMemberName(value string) string { + if strings.TrimSpace(value) == "" { + return "Empty" + } + + cleaned := strings.Map(func(r rune) rune { + if unicode.IsLetter(r) || unicode.IsDigit(r) { + return r + } + return '_' + }, value) + + cleaned = strings.Trim(cleaned, "_") + for strings.Contains(cleaned, "__") { + cleaned = strings.ReplaceAll(cleaned, "__", "_") + } + + if cleaned == "" { + return "Empty" + } + + parts := strings.Split(cleaned, "_") + var result strings.Builder + + for _, part := range parts { + if len(part) > 0 { + result.WriteString(strings.ToUpper(string(part[0]))) + if len(part) > 1 { + result.WriteString(strings.ToLower(part[1:])) + } + } + } + + memberName := result.String() + + if len(memberName) > 0 && unicode.IsDigit(rune(memberName[0])) { + memberName = "Value" + memberName + } + + if memberName == "" { + memberName = "Empty" + } + + return memberName +} + +func normalizePathEnums(paths map[string]interface{}) []ConflictDetail { + conflicts := make([]ConflictDetail, 0) + + fmt.Printf("\n=== Normalizing Path/Operation Enum Properties ===\n") + + allPathEnums := findAllPathEnumProperties(paths) + + if len(allPathEnums) == 0 { + fmt.Printf("No path enum properties found to normalize\n") + return conflicts + } + + fmt.Printf("Found %d path enum properties to normalize\n", len(allPathEnums)) + + for _, enumInfo := range allPathEnums { + conflict := transformEnumProperty(enumInfo) + if conflict != nil { + conflicts = append(conflicts, *conflict) + } + } + + fmt.Printf("Successfully normalized %d path enum properties\n", len(conflicts)) + return conflicts +} + +func findAllPathEnumProperties(paths map[string]interface{}) []EnumNormalizationInfo { + var allEnums []EnumNormalizationInfo + + for pathName, pathItem := range paths { + pathMap, ok := pathItem.(map[string]interface{}) + if !ok { + continue + } + + methods := []string{"get", "post", "put", "patch", "delete"} + for _, method := range methods { + if operation, exists := pathMap[method]; exists { + opMap, ok := operation.(map[string]interface{}) + if !ok { + continue + } + + if parameters, hasParams := opMap["parameters"]; hasParams { + paramsList, ok := parameters.([]interface{}) + if ok { + for _, param := range paramsList { + paramMap, ok := param.(map[string]interface{}) + if ok { + paramName, _ := paramMap["name"].(string) + schemaName := fmt.Sprintf("RequestParam_%s_%s_%s", method, pathName, paramName) + + if schema, hasSchema := paramMap["schema"].(map[string]interface{}); hasSchema { + enumEnums := findEnumsInSchemaRecursive(schemaName, schema, "", schema) + for j := range enumEnums { + enumEnums[j].PropertyName = convertToEnumMemberName(paramName) + enumEnums[j].SchemaName = "RequestParam" + } + allEnums = append(allEnums, enumEnums...) + } + } + } + } + } + + if requestBody, hasReqBody := opMap["requestBody"]; hasReqBody { + reqBodyMap, ok := requestBody.(map[string]interface{}) + if ok { + if content, hasContent := reqBodyMap["content"].(map[string]interface{}); hasContent { + for contentType, contentSchema := range content { + if contentMap, ok := contentSchema.(map[string]interface{}); ok { + if schema, hasSchema := contentMap["schema"].(map[string]interface{}); hasSchema { + schemaName := fmt.Sprintf("RequestBody_%s_%s", method, sanitizePathForSchemaName(pathName)) + reqEnums := findEnumsInSchemaRecursive(schemaName, schema, "", schema) + + for j := range reqEnums { + if contentType == "multipart/form-data" { + reqEnums[j].PropertyName = "Form" + convertToEnumMemberName(reqEnums[j].PropertyName) + } else { + reqEnums[j].PropertyName = "Request" + convertToEnumMemberName(reqEnums[j].PropertyName) + } + reqEnums[j].SchemaName = "RequestBody" + } + allEnums = append(allEnums, reqEnums...) + } + } + } + } + } + } + + // Checks for responses with inline enums enums, uncommon but included as a safeguard + if responses, hasResponses := opMap["responses"]; hasResponses { + respMap, ok := responses.(map[string]interface{}) + if ok { + for statusCode, response := range respMap { + if respBody, ok := response.(map[string]interface{}); ok { + if content, hasContent := respBody["content"].(map[string]interface{}); hasContent { + if jsonContent, hasJson := content["application/json"].(map[string]interface{}); hasJson { + if schema, hasSchema := jsonContent["schema"].(map[string]interface{}); hasSchema { + schemaName := fmt.Sprintf("Response_%s_%s_%s", method, pathName, statusCode) + respEnums := findEnumsInSchemaRecursive(schemaName, schema, "", schema) + allEnums = append(allEnums, respEnums...) + } + } + } + } + } + } + } + } + } + } + + return allEnums +} + +func sanitizePathForSchemaName(path string) string { + cleaned := strings.ReplaceAll(path, "/", "_") + cleaned = strings.ReplaceAll(cleaned, "{", "") + cleaned = strings.ReplaceAll(cleaned, "}", "") + cleaned = strings.Trim(cleaned, "_") + return cleaned +} diff --git a/scripts/normalize/main.go b/scripts/normalize/main.go new file mode 100644 index 0000000..e51ac6b --- /dev/null +++ b/scripts/normalize/main.go @@ -0,0 +1,113 @@ +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" +) + +func main() { + if len(os.Args) < 2 { + printUsage() + os.Exit(1) + } + + inputPath := os.Args[1] + outputPath := inputPath + if len(os.Args) > 2 { + outputPath = os.Args[2] + } + + fmt.Printf("=== OpenAPI Schema Normalizer ===\n") + fmt.Printf("Input: %s\n", inputPath) + fmt.Printf("Output: %s\n\n", outputPath) + + specData, err := ioutil.ReadFile(inputPath) + if err != nil { + fmt.Printf("Error reading spec: %v\n", err) + os.Exit(1) + } + + var spec map[string]interface{} + if err := json.Unmarshal(specData, &spec); err != nil { + fmt.Printf("Error parsing JSON: %v\n", err) + os.Exit(1) + } + + report := normalizeSpec(spec) + + printNormalizationReport(report) + + normalizedData, err := json.MarshalIndent(spec, "", " ") + if err != nil { + fmt.Printf("Error marshaling normalized spec: %v\n", err) + os.Exit(1) + } + + if err := ioutil.WriteFile(outputPath, normalizedData, 0644); err != nil { + fmt.Printf("Error writing normalized spec: %v\n", err) + os.Exit(1) + } + + fmt.Printf("\n✅ Successfully normalized OpenAPI spec\n") + fmt.Printf(" Total fixes applied: %d\n", report.TotalFixes) +} + +func printUsage() { + fmt.Println("OpenAPI Schema Normalizer") + fmt.Println() + fmt.Println("Usage:") + fmt.Println(" openapi-normalize [output.json]") +} + +type NormalizationReport struct { + TotalFixes int + MapClassFixes int + PropertyFixes int + ConflictDetails []ConflictDetail +} + +type ConflictDetail struct { + Schema string + Property string + ConflictType string + Resolution string +} + +func printNormalizationReport(report NormalizationReport) { + fmt.Println("\n=== Normalization Report ===") + fmt.Printf("Total fixes applied: %d\n", report.TotalFixes) + + mapClassFixes := 0 + parameterFixes := 0 + enumFixes := 0 + otherFixes := 0 + + for _, detail := range report.ConflictDetails { + switch detail.ConflictType { + case "map-class": + mapClassFixes++ + case "parameter-type": + parameterFixes++ + case "enum-normalization": + enumFixes++ + default: + otherFixes++ + } + } + + fmt.Printf("Map/Class fixes: %d\n", mapClassFixes) + fmt.Printf("Parameter type fixes: %d\n", parameterFixes) + fmt.Printf("Enum normalization fixes: %d\n", enumFixes) + fmt.Printf("Other fixes: %d\n", otherFixes) + + // Helpful for debugging + // if len(report.ConflictDetails) > 0 { + // fmt.Println("\nDetailed fixes:") + // for _, detail := range report.ConflictDetails { + // fmt.Printf(" - %s.%s [%s]: %s\n", + // detail.Schema, detail.Property, detail.ConflictType, detail.Resolution) + // } + // } +} diff --git a/scripts/normalize/normalize.go b/scripts/normalize/normalize.go new file mode 100644 index 0000000..3221c2b --- /dev/null +++ b/scripts/normalize/normalize.go @@ -0,0 +1,569 @@ +package main + +import ( + "fmt" + "strings" + + "github.com/firehydrant/terraform-provider-firehydrant/scripts/common" +) + +func normalizeSpec(spec map[string]interface{}) NormalizationReport { + report := NormalizationReport{ + ConflictDetails: make([]ConflictDetail, 0), + } + + components, ok := spec["components"].(map[string]interface{}) + if !ok { + fmt.Println("Warning: No components found in spec") + return report + } + + schemas, ok := components["schemas"].(map[string]interface{}) + if !ok { + fmt.Println("Warning: No schemas found in components") + return report + } + + // Add spec reference to each schema for context during normalization + for _, schema := range schemas { + if schemaMap, ok := schema.(map[string]interface{}); ok { + schemaMap["__spec"] = spec + } + } + + paths, pathsOk := spec["paths"].(map[string]interface{}) + if !pathsOk { + fmt.Println("Warning: No paths found in spec") + } + + entityMap := buildEntityRelationships(schemas, paths) + requiredFieldsMap := make(map[string]map[string]bool) + + for entityName, related := range entityMap { + requiredFields := make(map[string]bool) + if related.CreateSchema != "" { + if createSchema, ok := schemas[related.CreateSchema].(map[string]interface{}); ok { + if required, ok := createSchema["required"].([]interface{}); ok { + for _, field := range required { + if fieldName, ok := field.(string); ok { + requiredFields[fieldName] = true + } + } + } + } + } + requiredFieldsMap[entityName] = requiredFields + } + + for entityName, related := range entityMap { + entitySchema, ok := schemas[entityName].(map[string]interface{}) + if !ok { + continue + } + + requiredFields := requiredFieldsMap[entityName] + + if related.CreateSchema != "" { + if createSchema, ok := schemas[related.CreateSchema].(map[string]interface{}); ok { + conflicts := normalizeSchemas(entityName, entitySchema, createSchema, requiredFields) + report.ConflictDetails = append(report.ConflictDetails, conflicts...) + } + } + + if related.UpdateSchema != "" { + if updateSchema, ok := schemas[related.UpdateSchema].(map[string]interface{}); ok { + conflicts := normalizeSchemas(entityName, entitySchema, updateSchema, requiredFields) + report.ConflictDetails = append(report.ConflictDetails, conflicts...) + } + } + } + + // Clean up spec reference + for _, schema := range schemas { + if schemaMap, ok := schema.(map[string]interface{}); ok { + delete(schemaMap, "__spec") + } + } + + globalFixes := applyGlobalNormalizations(schemas) + report.ConflictDetails = append(report.ConflictDetails, globalFixes...) + + enumFixes := normalizeEnums(schemas) + report.ConflictDetails = append(report.ConflictDetails, enumFixes...) + + if pathsOk { + parameterFixes := normalizePathParameters(paths) + report.ConflictDetails = append(report.ConflictDetails, parameterFixes...) + + pathEnumFixes := normalizePathEnums(paths) + report.ConflictDetails = append(report.ConflictDetails, pathEnumFixes...) + } + + report.TotalFixes = len(report.ConflictDetails) + for _, detail := range report.ConflictDetails { + if detail.ConflictType == "map-class" { + report.MapClassFixes++ + } else { + report.PropertyFixes++ + } + } + + return report +} + +func applyGlobalNormalizations(schemas map[string]interface{}) []ConflictDetail { + conflicts := make([]ConflictDetail, 0) + + fmt.Printf("Applying global normalizations to %d schemas\n", len(schemas)) + + for schemaName, schema := range schemas { + schemaMap, ok := schema.(map[string]interface{}) + if !ok { + continue + } + + schemaConflicts := normalizeAdditionalProperties(schemaName, schemaMap, "") + conflicts = append(conflicts, schemaConflicts...) + } + + return conflicts +} + +type EntityRelationship struct { + EntityName string + CreateSchema string + UpdateSchema string +} + +func buildEntityRelationships(schemas map[string]interface{}, paths map[string]interface{}) map[string]EntityRelationship { + relationships := make(map[string]EntityRelationship) + + // First: identify all entities + for schemaName := range schemas { + if strings.HasSuffix(schemaName, "Entity") && !strings.Contains(schemaName, "Nullable") && !strings.Contains(schemaName, "Paginated") { + rel := EntityRelationship{ + EntityName: schemaName, + } + relationships[schemaName] = rel + } + } + + // Second: Try standard naming convention + for entityName, rel := range relationships { + baseName := strings.ToLower(strings.TrimSuffix(entityName, "Entity")) + + createName := "create_" + baseName + if _, exists := schemas[createName]; exists { + rel.CreateSchema = createName + relationships[entityName] = rel + } + + updateName := "update_" + baseName + if _, exists := schemas[updateName]; exists { + rel.UpdateSchema = updateName + relationships[entityName] = rel + } + } + + // Third: Use paths to find non-standard mappings + for pathName, pathItem := range paths { + pathMap, ok := pathItem.(map[string]interface{}) + if !ok { + continue + } + + // Check PUT, POST, PATCH operations + for method, operation := range pathMap { + if method != "put" && method != "post" && method != "patch" { + continue + } + + opMap, ok := operation.(map[string]interface{}) + if !ok { + continue + } + + requestSchema := getRequestSchema(opMap) + responseEntity := getResponseEntity(opMap) + + if requestSchema != "" && responseEntity != "" { + if rel, exists := relationships[responseEntity]; exists { + operationID, _ := opMap["operationId"].(string) + + if strings.Contains(operationID, "create") || + (method == "put" && !strings.Contains(pathName, "{")) { + if rel.CreateSchema == "" || rel.CreateSchema == requestSchema { + rel.CreateSchema = requestSchema + relationships[responseEntity] = rel + } + } else if strings.Contains(operationID, "update") || + (method == "patch") { + if rel.UpdateSchema == "" || rel.UpdateSchema == requestSchema { + rel.UpdateSchema = requestSchema + relationships[responseEntity] = rel + } + } + } + } + } + } + + return relationships +} + +func getRequestSchema(operation map[string]interface{}) string { + if requestBody, ok := operation["requestBody"].(map[string]interface{}); ok { + if content, ok := requestBody["content"].(map[string]interface{}); ok { + if jsonContent, ok := content["application/json"].(map[string]interface{}); ok { + if schema, ok := jsonContent["schema"].(map[string]interface{}); ok { + if ref, ok := schema["$ref"].(string); ok { + parts := strings.Split(ref, "/") + if len(parts) > 0 { + return parts[len(parts)-1] + } + } + } + } + } + } + return "" +} + +func getResponseEntity(operation map[string]interface{}) string { + if responses, ok := operation["responses"].(map[string]interface{}); ok { + for _, status := range []string{"200", "201", "202"} { + if response, ok := responses[status].(map[string]interface{}); ok { + if content, ok := response["content"].(map[string]interface{}); ok { + if jsonContent, ok := content["application/json"].(map[string]interface{}); ok { + if schema, ok := jsonContent["schema"].(map[string]interface{}); ok { + if ref, ok := schema["$ref"].(string); ok { + parts := strings.Split(ref, "/") + if len(parts) > 0 { + schemaName := parts[len(parts)-1] + if strings.HasSuffix(schemaName, "Entity") { + return schemaName + } + } + } + } + } + } + } + } + } + return "" +} + +func normalizeSchemas(entityName string, entitySchema map[string]interface{}, + requestSchema map[string]interface{}, requiredFields map[string]bool) []ConflictDetail { + + conflicts := make([]ConflictDetail, 0) + + entityProps, _ := entitySchema["properties"].(map[string]interface{}) + requestProps, _ := requestSchema["properties"].(map[string]interface{}) + + if entityProps == nil { + entityProps = make(map[string]interface{}) + entitySchema["properties"] = entityProps + } + + if requestProps == nil { + return conflicts + } + + // First pass: Add ALL required fields that are missing (existing logic) + for propName := range requiredFields { + requestProp, existsInRequest := requestProps[propName] + if !existsInRequest { + // Required field not in request schema - this shouldn't happen + fmt.Printf("WARNING: Required field '%s' not found in request schema\n", propName) + continue + } + + _, existsInEntity := entityProps[propName] + if !existsInEntity { + copiedProp := deepCopyProperties(requestProp) + + // Make the field nullable in entity since it might not be returned by API + if propMap, ok := copiedProp.(map[string]interface{}); ok { + propMap["nullable"] = true + } + + entityProps[propName] = copiedProp + + conflicts = append(conflicts, ConflictDetail{ + Schema: entityName, + Property: propName, + ConflictType: "missing-required-field", + Resolution: fmt.Sprintf("Added missing required field '%s' from request to entity", propName), + }) + } + } + + // Second pass: Check and fix ALL properties with deep structure analysis + // Get schemas for ref resolution + spec, _ := entitySchema["__spec"].(map[string]interface{}) + components, _ := spec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + for propName, requestProp := range requestProps { + entityProp, exists := entityProps[propName] + + if exists { + // Property exists in both - check if structures match + if !common.ComparePropertyStructures(entityProp, requestProp, schemas) { + // Structures don't match - normalize the entity property + normalized := normalizePropertyStructure(entityProp, requestProp, schemas, propName) + entityProps[propName] = normalized + + conflicts = append(conflicts, ConflictDetail{ + Schema: entityName, + Property: propName, + ConflictType: "structure-normalized", + Resolution: fmt.Sprintf("Normalized structure of '%s' to match request schema", propName), + }) + } else { + // Structures match but check for the existing special cases + isRequired := requiredFields[propName] + conflict := checkAndFixProperty(entityName, propName, entityProp, requestProp, + entityProps, requestProps, isRequired) + if conflict != nil { + conflicts = append(conflicts, *conflict) + } + } + } else { + // Property missing in entity - add it + copiedProp := deepCopyProperties(requestProp) + + if propMap, ok := copiedProp.(map[string]interface{}); ok { + propMap["nullable"] = true + } + + entityProps[propName] = copiedProp + + conflicts = append(conflicts, ConflictDetail{ + Schema: entityName, + Property: propName, + ConflictType: "missing-field", + Resolution: fmt.Sprintf("Added missing field '%s' from request to entity", propName), + }) + } + } + + return conflicts +} + +func checkAndFixProperty(entityName, propName string, entityProp, requestProp interface{}, + entityProps, requestProps map[string]interface{}, isRequired bool) *ConflictDetail { + + entityPropMap, _ := entityProp.(map[string]interface{}) + requestPropMap, _ := requestProp.(map[string]interface{}) + + if entityPropMap == nil || requestPropMap == nil { + return nil + } + + entityType, _ := entityPropMap["type"].(string) + requestType, _ := requestPropMap["type"].(string) + + if isRequired && entityType == "object" && requestType == "object" { + entityPropsValue, entityHasProps := entityPropMap["properties"].(map[string]interface{}) + requestPropsValue, requestHasProps := requestPropMap["properties"].(map[string]interface{}) + + needsAlignment := false + + if requestHasProps && !entityHasProps { + needsAlignment = true + } else if requestHasProps && entityHasProps { + // Both have properties - check if they match + requestPropCount := len(requestPropsValue) + entityPropCount := len(entityPropsValue) + + // Entity has empty properties, request has nested structure + if entityPropCount == 0 && requestPropCount > 0 { + needsAlignment = true + } else if requestPropCount != entityPropCount { + needsAlignment = true + } else { + // Check if property names match + for propKey := range requestPropsValue { + if _, exists := entityPropsValue[propKey]; !exists { + needsAlignment = true + break + } + } + } + } + + if needsAlignment { + alignedProp := make(map[string]interface{}) + alignedProp["type"] = "object" + alignedProp["nullable"] = true + + if desc, ok := requestPropMap["description"]; ok { + alignedProp["description"] = desc + } + + if requestHasProps { + alignedProp["properties"] = deepCopyProperties(requestPropsValue) + } else { + alignedProp["properties"] = make(map[string]interface{}) + } + + entityProps[propName] = alignedProp + + return &ConflictDetail{ + Schema: entityName, + Property: propName, + ConflictType: "required-structure-alignment", + Resolution: fmt.Sprintf("Aligned structure of required field '%s' to match request schema", propName), + } + } + } + + if entityType == "object" && requestType == "object" { + _, entityHasProps := entityPropMap["properties"] + _, entityHasAdditional := entityPropMap["additionalProperties"] + _, requestHasProps := requestPropMap["properties"] + _, requestHasAdditional := requestPropMap["additionalProperties"] + + if entityHasProps && requestHasProps { + entityPropsObj, _ := entityPropMap["properties"].(map[string]interface{}) + requestPropsObj, _ := requestPropMap["properties"].(map[string]interface{}) + + if len(entityPropsObj) == 0 && len(requestPropsObj) == 0 { + return nil + } + } + + if entityHasAdditional && !requestHasAdditional && requestHasProps { + delete(entityPropMap, "additionalProperties") + entityPropMap["properties"] = map[string]interface{}{} + entityProps[propName] = entityPropMap + + return &ConflictDetail{ + Schema: entityName, + Property: propName, + ConflictType: "map-class", + Resolution: "Converted entity from additionalProperties to empty properties", + } + } + + if requestHasAdditional && !entityHasAdditional && entityHasProps { + delete(requestPropMap, "additionalProperties") + requestPropMap["properties"] = map[string]interface{}{} + requestProps[propName] = requestPropMap + + return &ConflictDetail{ + Schema: entityName, + Property: propName, + ConflictType: "map-class", + Resolution: "Converted request from additionalProperties to empty properties", + } + } + } + + return nil +} + +// deepCopyProperties recursively copies properties to ensure they are nullable +// We need to make sure everything is nullable since we are generally copying from request schemas into resposne entities with this function +// This is necessary so that required fields in request schemas are not ignored in generation and make it into our terraform resources, as they would otherwise mismatch between request and response +func deepCopyProperties(props interface{}) interface{} { + switch v := props.(type) { + case map[string]interface{}: + copied := make(map[string]interface{}) + for key, val := range v { + if propMap, ok := val.(map[string]interface{}); ok { + + copiedProp := make(map[string]interface{}) + for pk, pv := range propMap { + copiedProp[pk] = deepCopyProperties(pv) + } + + // Ensure nested objects are also nullable + if propType, ok := copiedProp["type"].(string); ok && propType == "object" { + copiedProp["nullable"] = true + } + + copied[key] = copiedProp + } else { + copied[key] = deepCopyProperties(val) + } + } + return copied + case []interface{}: + copied := make([]interface{}, len(v)) + for i, val := range v { + copied[i] = deepCopyProperties(val) + } + return copied + default: + return v + } +} + +// normalizePropertyStructure aligns entity property structure with request property structure +func normalizePropertyStructure(entityProp, requestProp interface{}, schemas map[string]interface{}, propName string) interface{} { + requestResolved, requestType := common.GetResolvedPropertyType(requestProp, schemas) + entityResolved, _ := common.GetResolvedPropertyType(entityProp, schemas) + + if requestResolved == nil { + return entityProp + } + + normalized := make(map[string]interface{}) + + if propType, ok := requestResolved["type"].(string); ok { + normalized["type"] = propType + } + if description, ok := requestResolved["description"].(string); ok { + normalized["description"] = description + } + + // Always make nullable in entity as it might not be returned by API + normalized["nullable"] = true + + if propType, _ := requestResolved["type"].(string); propType == "object" { + if requestProps, ok := requestResolved["properties"].(map[string]interface{}); ok { + normalizedProps := make(map[string]interface{}) + + for subPropName, requestSubProp := range requestProps { + normalizedProps[subPropName] = deepCopyProperties(requestSubProp) + } + + if entityResolved != nil { + if entityProps, ok := entityResolved["properties"].(map[string]interface{}); ok { + for subPropName, entitySubProp := range entityProps { + if _, existsInRequest := requestProps[subPropName]; !existsInRequest { + // This is a computed field, keep it as-is + normalizedProps[subPropName] = entitySubProp + } + } + } + } + + normalized["properties"] = normalizedProps + } + + if required, ok := requestResolved["required"].([]interface{}); ok { + normalized["required"] = required + } + } else if propType, _ := requestResolved["type"].(string); propType == "array" { + if requestItems, ok := requestResolved["items"].(map[string]interface{}); ok { + if entityResolved != nil && entityResolved["items"] != nil { + normalized["items"] = normalizePropertyStructure(entityResolved["items"], requestItems, schemas, propName+"[]") + } else { + normalized["items"] = deepCopyProperties(requestItems) + } + } + } + + if entityMap, ok := entityProp.(map[string]interface{}); ok { + if ref, hadRef := entityMap["$ref"].(string); hadRef && requestType == "inline" { + fmt.Printf(" Normalized %s: inlined $ref %s to match request structure\n", propName, ref) + } + } + + return normalized +} diff --git a/scripts/normalize/path-params.go b/scripts/normalize/path-params.go new file mode 100644 index 0000000..40caa50 --- /dev/null +++ b/scripts/normalize/path-params.go @@ -0,0 +1,77 @@ +package main + +import ( + "fmt" + "strings" +) + +// Normalize path parameters to match entity ID types +func normalizePathParameters(paths map[string]interface{}) []ConflictDetail { + conflicts := make([]ConflictDetail, 0) + + fmt.Printf("\n=== Normalizing Path Parameters ===\n") + + for pathName, pathItem := range paths { + pathMap, ok := pathItem.(map[string]interface{}) + if !ok { + continue + } + + methods := []string{"get", "post", "put", "patch", "delete"} + for _, method := range methods { + if operation, exists := pathMap[method]; exists { + opMap, ok := operation.(map[string]interface{}) + if !ok { + continue + } + + if parameters, hasParams := opMap["parameters"]; hasParams { + paramsList, ok := parameters.([]interface{}) + if !ok { + continue + } + + for _, param := range paramsList { + paramMap, ok := param.(map[string]interface{}) + if !ok { + continue + } + + paramIn, _ := paramMap["in"].(string) + paramName, _ := paramMap["name"].(string) + + if paramIn == "path" && (strings.Contains(paramName, "id") || strings.HasSuffix(paramName, "_id")) { + schema, hasSchema := paramMap["schema"] + if hasSchema { + schemaMap, ok := schema.(map[string]interface{}) + if ok { + paramType, _ := schemaMap["type"].(string) + paramFormat, _ := schemaMap["format"].(string) + + if paramType == "integer" { + fmt.Printf(" Found integer ID parameter: %s %s.%s (type: %s, format: %s)\n", + method, pathName, paramName, paramType, paramFormat) + + schemaMap["type"] = "string" + delete(schemaMap, "format") + + conflicts = append(conflicts, ConflictDetail{ + Schema: fmt.Sprintf("path:%s", pathName), + Property: fmt.Sprintf("%s.%s", method, paramName), + ConflictType: "parameter-type", + Resolution: fmt.Sprintf("Converted path parameter %s from integer to string", paramName), + }) + + fmt.Printf(" ✅ Converted %s parameter from integer to string\n", paramName) + } + } + } + } + } + } + } + } + } + + return conflicts +} diff --git a/scripts/normalize/properties.go b/scripts/normalize/properties.go new file mode 100644 index 0000000..395c419 --- /dev/null +++ b/scripts/normalize/properties.go @@ -0,0 +1,55 @@ +package main + +import "fmt" + +func normalizeAdditionalProperties(schemaName string, obj interface{}, path string) []ConflictDetail { + var conflicts []ConflictDetail + + switch v := obj.(type) { + case map[string]interface{}: + if _, hasAdditional := v["additionalProperties"]; hasAdditional { + objType, _ := v["type"].(string) + _, hasProperties := v["properties"] + + if objType == "object" || hasProperties || (!hasProperties && hasAdditional) { + delete(v, "additionalProperties") + if !hasProperties { + v["properties"] = map[string]interface{}{} + } + + fullPath := schemaName + if path != "" { + fullPath += "." + path + } + + conflicts = append(conflicts, ConflictDetail{ + Schema: schemaName, + Property: path, + ConflictType: "map-class", + Resolution: fmt.Sprintf("Converted additionalProperties to empty properties at %s", fullPath), + }) + + fmt.Printf(" ✅ Converted additionalProperties to empty properties at %s\n", fullPath) + } + } + + for key, value := range v { + newPath := path + if newPath != "" { + newPath += "." + key + } else { + newPath = key + } + nested := normalizeAdditionalProperties(schemaName, value, newPath) + conflicts = append(conflicts, nested...) + } + case []interface{}: + for i, item := range v { + newPath := fmt.Sprintf("%s[%d]", path, i) + nested := normalizeAdditionalProperties(schemaName, item, newPath) + conflicts = append(conflicts, nested...) + } + } + + return conflicts +} diff --git a/scripts/overlay/add-ignores.go b/scripts/overlay/add-ignores.go new file mode 100644 index 0000000..afd219a --- /dev/null +++ b/scripts/overlay/add-ignores.go @@ -0,0 +1,74 @@ +package main + +import "fmt" + +func addIgnoreActionsForMismatches(overlay *Overlay, resource *ResourceInfo, mismatches []PropertyMismatch, ignoreTracker map[string]map[string]bool) { + if resource.CreateSchema != "" { + for _, mismatch := range mismatches { + // Ignore in request schema + if !ignoreTracker[resource.CreateSchema][mismatch.PropertyName] { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", resource.CreateSchema, mismatch.PropertyName), + Update: map[string]interface{}{ + "x-speakeasy-ignore": true, + }, + }) + ignoreTracker[resource.CreateSchema][mismatch.PropertyName] = true + } + + // Also ignore in response entity schema + if !ignoreTracker[resource.EntityName][mismatch.PropertyName] { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", resource.EntityName, mismatch.PropertyName), + Update: map[string]interface{}{ + "x-speakeasy-ignore": true, + }, + }) + ignoreTracker[resource.EntityName][mismatch.PropertyName] = true + } + } + } + + if resource.UpdateSchema != "" { + for _, mismatch := range mismatches { + // Ignore in request schema + if !ignoreTracker[resource.UpdateSchema][mismatch.PropertyName] { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", resource.UpdateSchema, mismatch.PropertyName), + Update: map[string]interface{}{ + "x-speakeasy-ignore": true, + }, + }) + ignoreTracker[resource.UpdateSchema][mismatch.PropertyName] = true + } + + // Also ignore in response entity schema (avoid duplicates) + if !ignoreTracker[resource.EntityName][mismatch.PropertyName] { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", resource.EntityName, mismatch.PropertyName), + Update: map[string]interface{}{ + "x-speakeasy-ignore": true, + }, + }) + ignoreTracker[resource.EntityName][mismatch.PropertyName] = true + } + } + } +} + +func addIgnoreActionsForInconsistencies(overlay *Overlay, inconsistencies []CRUDInconsistency, ignoreTracker map[string]map[string]bool) { + for _, inconsistency := range inconsistencies { + // Add ignore actions for each schema listed in SchemasToIgnore + for _, schemaName := range inconsistency.SchemasToIgnore { + if !ignoreTracker[schemaName][inconsistency.PropertyName] { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", schemaName, inconsistency.PropertyName), + Update: map[string]interface{}{ + "x-speakeasy-ignore": true, + }, + }) + ignoreTracker[schemaName][inconsistency.PropertyName] = true + } + } + } +} diff --git a/scripts/overlay/analyze-spec.go b/scripts/overlay/analyze-spec.go new file mode 100644 index 0000000..21c76bb --- /dev/null +++ b/scripts/overlay/analyze-spec.go @@ -0,0 +1,373 @@ +package main + +import ( + "fmt" + "regexp" + "strings" + "unicode" +) + +type ResourceInfo struct { + EntityName string + SchemaName string + ResourceName string + Operations map[string]OperationInfo + CreateSchema string + UpdateSchema string + // Store the identified primary ID parameter + // We need to track this so that we use the correct ID field where there are multiple IDs in path params + PrimaryID string +} + +type OperationInfo struct { + OperationID string + Path string + Method string + RequestSchema string +} + +func analyzeSpec(spec OpenAPISpec, manualMappings *ManualMappings) map[string]*ResourceInfo { + resources := make(map[string]*ResourceInfo) + + // First pass: identify all entity schemas + entitySchemas := identifyEntitySchemas(spec.Components.Schemas) + fmt.Printf("Identified %d entity schemas\n", len(entitySchemas)) + + // Second pass: match operations to entities + for path, pathItem := range spec.Paths { + analyzePathOperations(path, pathItem, entitySchemas, resources, manualMappings) + } + + return resources +} + +func identifyEntitySchemas(schemas map[string]Schema) map[string]bool { + entities := make(map[string]bool) + + for name, schema := range schemas { + if isEntitySchema(name, schema) { + entities[name] = true + } + } + + return entities +} + +func isEntitySchema(name string, schema Schema) bool { + lowerName := strings.ToLower(name) + if strings.HasPrefix(lowerName, "create_") || + strings.HasPrefix(lowerName, "update_") || + strings.HasPrefix(lowerName, "delete_") || + strings.Contains(lowerName, "request") || + strings.Contains(lowerName, "response") || + strings.HasSuffix(name, "Paginated") { + return false + } + + // Many of our schemas are nullable wrappers, to enable optional child schemas as properties in our sdks + // skip these + if strings.HasPrefix(name, "Nullable") { + return false + } + + if schema.Type != "object" || len(schema.Properties) == 0 { + return false + } + + _, hasID := schema.Properties["id"] + _, hasSlug := schema.Properties["slug"] + hasSuffix := strings.HasSuffix(name, "Entity") + + hasIdentifier := hasID || hasSlug + return hasSuffix && hasIdentifier +} + +func analyzePathOperations(path string, pathItem PathItem, entitySchemas map[string]bool, + resources map[string]*ResourceInfo, manualMappings *ManualMappings) { + + operations := []struct { + method string + op *Operation + }{ + {"get", pathItem.Get}, + {"post", pathItem.Post}, + {"put", pathItem.Put}, + {"patch", pathItem.Patch}, + {"delete", pathItem.Delete}, + } + + for _, item := range operations { + if item.op == nil { + continue + } + + if shouldIgnoreOperation(path, item.method, manualMappings) { + continue + } + + resourceInfo := extractResourceInfo(path, item.method, item.op, entitySchemas, manualMappings) + if resourceInfo != nil { + if existing, exists := resources[resourceInfo.ResourceName]; exists { + for opType, opInfo := range resourceInfo.Operations { + existing.Operations[opType] = opInfo + } + + if resourceInfo.CreateSchema != "" { + existing.CreateSchema = resourceInfo.CreateSchema + } + if resourceInfo.UpdateSchema != "" { + existing.UpdateSchema = resourceInfo.UpdateSchema + } + } else { + resources[resourceInfo.ResourceName] = resourceInfo + } + } + } +} + +func extractResourceInfo(path, method string, op *Operation, + entitySchemas map[string]bool, manualMappings *ManualMappings) *ResourceInfo { + + crudType := determineCrudType(path, method, op.OperationID) + if crudType == "" { + return nil + } + + if manualEntityName, hasManual := getManualEntityMapping(path, method, manualMappings); hasManual { + entityName := manualEntityName + resourceName := deriveResourceName(entityName) + + info := &ResourceInfo{ + EntityName: entityName, + SchemaName: entityName, + ResourceName: resourceName, + Operations: make(map[string]OperationInfo), + } + + opInfo := OperationInfo{ + OperationID: op.OperationID, + Path: path, + Method: method, + } + + if crudType == "create" || crudType == "update" { + if op.RequestBody != nil { + if content, ok := op.RequestBody["content"].(map[string]interface{}); ok { + if jsonContent, ok := content["application/json"].(map[string]interface{}); ok { + if schema, ok := jsonContent["schema"].(map[string]interface{}); ok { + if ref, ok := schema["$ref"].(string); ok { + requestSchemaName := extractSchemaName(ref) + opInfo.RequestSchema = requestSchemaName + + if crudType == "create" { + info.CreateSchema = requestSchemaName + } else if crudType == "update" { + info.UpdateSchema = requestSchemaName + } + } + } + } + } + } + } + + info.Operations[crudType] = opInfo + return info + } + + entityName := findEntityFromOperation(op, entitySchemas) + if entityName == "" { + return nil + } + + resourceName := deriveResourceName(entityName) + + info := &ResourceInfo{ + EntityName: entityName, + SchemaName: entityName, + ResourceName: resourceName, + Operations: make(map[string]OperationInfo), + } + + opInfo := OperationInfo{ + OperationID: op.OperationID, + Path: path, + Method: method, + } + + if crudType == "create" || crudType == "update" { + if op.RequestBody != nil { + if content, ok := op.RequestBody["content"].(map[string]interface{}); ok { + if jsonContent, ok := content["application/json"].(map[string]interface{}); ok { + if schema, ok := jsonContent["schema"].(map[string]interface{}); ok { + if ref, ok := schema["$ref"].(string); ok { + requestSchemaName := extractSchemaName(ref) + opInfo.RequestSchema = requestSchemaName + + if crudType == "create" { + info.CreateSchema = requestSchemaName + } else if crudType == "update" { + info.UpdateSchema = requestSchemaName + } + } + } + } + } + } + } + + info.Operations[crudType] = opInfo + return info +} + +func determineCrudType(path, method, operationID string) string { + lowerOp := strings.ToLower(operationID) + + if strings.Contains(lowerOp, "create") { + return "create" + } + if strings.Contains(lowerOp, "update") || strings.Contains(lowerOp, "patch") { + return "update" + } + if strings.Contains(lowerOp, "delete") { + return "delete" + } + if strings.Contains(lowerOp, "list") { + return "list" + } + if strings.Contains(lowerOp, "get") && strings.Contains(path, "{") { + return "read" + } + + switch method { + case "post": + if !strings.Contains(path, "{") { + return "create" + } + case "get": + if strings.Contains(path, "{") { + return "read" + } else { + return "list" + } + case "put": + if !strings.Contains(path, "{") { + return "create" + } + + return "update" + case "patch": + return "update" + case "delete": + return "delete" + } + + return "" +} + +func findEntityFromOperation(op *Operation, entitySchemas map[string]bool) string { + if op.Responses != nil { + for _, response := range op.Responses { + if respMap, ok := response.(map[string]interface{}); ok { + if content, ok := respMap["content"].(map[string]interface{}); ok { + if jsonContent, ok := content["application/json"].(map[string]interface{}); ok { + if schema, ok := jsonContent["schema"].(map[string]interface{}); ok { + entityName := findEntityInSchema(schema, entitySchemas) + if entityName != "" { + return entityName + } + } + } + } + } + } + } + + if len(op.Tags) > 0 { + for _, tag := range op.Tags { + possibleEntity := tag + "Entity" + if entitySchemas[possibleEntity] { + return possibleEntity + } + } + } + + return "" +} + +func findEntityInSchema(schema map[string]interface{}, entitySchemas map[string]bool) string { + if ref, ok := schema["$ref"].(string); ok { + schemaName := extractSchemaName(ref) + if entitySchemas[schemaName] { + return schemaName + } + } + + if props, ok := schema["properties"].(map[string]interface{}); ok { + if data, ok := props["data"].(map[string]interface{}); ok { + if dataType, ok := data["type"].(string); ok && dataType == "array" { + if items, ok := data["items"].(map[string]interface{}); ok { + if ref, ok := items["$ref"].(string); ok { + schemaName := extractSchemaName(ref) + if entitySchemas[schemaName] { + return schemaName + } + } + } + } + } + } + + return "" +} + +func extractSchemaName(ref string) string { + parts := strings.Split(ref, "/") + if len(parts) > 0 { + return parts[len(parts)-1] + } + return "" +} + +func deriveResourceName(entityName string) string { + resource := strings.TrimSuffix(entityName, "Entity") + + resource = toSnakeCase(resource) + + if strings.Contains(resource, "_") { + parts := strings.Split(resource, "_") + if len(parts) > 1 && parts[0] == parts[1] { + // Remove duplicate prefix (e.g., incidents_incident -> incident) + resource = parts[1] + } + } + + return resource +} + +func toSnakeCase(s string) string { + var result []rune + for i, r := range s { + if i > 0 && unicode.IsUpper(r) { + if i == len(s)-1 || !unicode.IsUpper(rune(s[i+1])) { + result = append(result, '_') + } + } + result = append(result, []rune(strings.ToLower(string(r)))...) + } + return string(result) +} + +func extractPathParameters(path string) []string { + re := regexp.MustCompile(`\{([^}]+)\}`) + matches := re.FindAllStringSubmatch(path, -1) + + var params []string + for _, match := range matches { + if len(match) > 1 { + params = append(params, match[1]) + } + } + + return params +} diff --git a/scripts/overlay/detect.go b/scripts/overlay/detect.go new file mode 100644 index 0000000..f333c42 --- /dev/null +++ b/scripts/overlay/detect.go @@ -0,0 +1,690 @@ +package main + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/firehydrant/terraform-provider-firehydrant/scripts/common" +) + +type PropertyMismatch struct { + PropertyName string + MismatchType string + Description string +} + +type CRUDInconsistency struct { + PropertyName string + InconsistencyType string + Description string + SchemasToIgnore []string +} + +func detectPropertyMismatches(resources map[string]*ResourceInfo, spec OpenAPISpec) map[string][]PropertyMismatch { + mismatches := make(map[string][]PropertyMismatch) + + specData, err := json.Marshal(spec) + if err != nil { + return mismatches + } + + var rawSpec map[string]interface{} + if err := json.Unmarshal(specData, &rawSpec); err != nil { + return mismatches + } + + components, _ := rawSpec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + for _, schema := range schemas { + if schemaMap, ok := schema.(map[string]interface{}); ok { + schemaMap["__spec"] = rawSpec + } + } + + requiredFieldsMap := make(map[string]map[string]bool) + for _, resource := range resources { + requiredFields := make(map[string]bool) + + if resource.CreateSchema != "" { + if createSchema, ok := schemas[resource.CreateSchema].(map[string]interface{}); ok { + if required, ok := createSchema["required"].([]interface{}); ok { + for _, field := range required { + if fieldName, ok := field.(string); ok { + requiredFields[fieldName] = true + } + } + } + } + } + + requiredFieldsMap[resource.EntityName] = requiredFields + } + + for _, resource := range resources { + var resourceMismatches []PropertyMismatch + requiredFields := requiredFieldsMap[resource.EntityName] + + if resource.CreateSchema != "" { + if entitySchema, exists := schemas[resource.EntityName].(map[string]interface{}); exists { + if requestSchema, exists := schemas[resource.CreateSchema].(map[string]interface{}); exists { + createMismatches := findPropertyMismatches(entitySchema, requestSchema, "create", requiredFields) + resourceMismatches = append(resourceMismatches, createMismatches...) + } + } + } + + if resource.UpdateSchema != "" { + if entitySchema, exists := schemas[resource.EntityName].(map[string]interface{}); exists { + if requestSchema, exists := schemas[resource.UpdateSchema].(map[string]interface{}); exists { + updateMismatches := findPropertyMismatches(entitySchema, requestSchema, "update", requiredFields) + resourceMismatches = append(resourceMismatches, updateMismatches...) + } + } + } + + if len(resourceMismatches) > 0 { + mismatches[resource.EntityName] = resourceMismatches + } + } + + for _, schema := range schemas { + if schemaMap, ok := schema.(map[string]interface{}); ok { + delete(schemaMap, "__spec") + } + } + + return mismatches +} + +func findPropertyMismatches(entitySchema, requestSchema map[string]interface{}, operation string, requiredFields map[string]bool) []PropertyMismatch { + var mismatches []PropertyMismatch + + entityProps, _ := entitySchema["properties"].(map[string]interface{}) + requestProps, _ := requestSchema["properties"].(map[string]interface{}) + + if entityProps == nil || requestProps == nil { + return mismatches + } + + spec, _ := entitySchema["__spec"].(map[string]interface{}) + components, _ := spec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + for propName, entityProp := range entityProps { + if requestProp, exists := requestProps[propName]; exists { + // Skip required fields, they should already be handled in normalization + // Ensures we do not accidentlaly ignore any required fields, prevents generating unusable resources + if requiredFields[propName] { + continue + } + + // Use deep comparison that follows refs + if schemas != nil && !common.ComparePropertyStructures(entityProp, requestProp, schemas) { + // Check if this is a fundamental mismatch that normalization couldn't fix + if hasStructuralMismatch(entityProp, requestProp) { + mismatch := PropertyMismatch{ + PropertyName: propName, + MismatchType: "structural-mismatch", + Description: describeStructuralDifference(entityProp, requestProp), + } + mismatches = append(mismatches, mismatch) + } + } + } + } + + return mismatches +} + +// The normalization phase should have already fixed most structural issues, this will locate any mismatches that could not be normalized +func hasStructuralMismatch(entityProp, requestProp interface{}) bool { + entityStructure := getPropertyStructure(entityProp) + requestStructure := getPropertyStructure(requestProp) + + // If structures are fundamentally incompatible (e.g., string vs object) + // and couldn't be normalized, then we have a mismatch + if entityStructure != requestStructure { + entityType := extractBaseType(entityStructure) + requestType := extractBaseType(requestStructure) + + // These cases should have been normalized, so if they still differ, it's a real mismatch + if entityType == requestType { + // If the underlying types are the same, assume normalization fixed this + return false + } + + return true + } + + return false +} + +func extractBaseType(structure string) string { + if strings.HasPrefix(structure, "array[") { + return "array" + } + if strings.HasPrefix(structure, "object") { + return "object" + } + if strings.HasPrefix(structure, "$ref:") { + return "ref" + } + return structure +} + +// Get a normalized string representation of a property's structure +func getPropertyStructure(prop interface{}) string { + propMap, ok := prop.(map[string]interface{}) + if !ok { + return "unknown" + } + + if ref, hasRef := propMap["$ref"].(string); hasRef { + return fmt.Sprintf("$ref:%s", ref) + } + + propType, _ := propMap["type"].(string) + + switch propType { + case "array": + items, hasItems := propMap["items"] + if hasItems { + itemStructure := getPropertyStructure(items) + return fmt.Sprintf("array[%s]", itemStructure) + } + return "array[unknown]" + + case "object": + properties, hasProps := propMap["properties"] + _, hasAdditional := propMap["additionalProperties"] + + if hasProps { + propsMap, _ := properties.(map[string]interface{}) + if len(propsMap) == 0 { + return "object{empty}" + } + return "object{defined}" + } + + if hasAdditional { + return "object{additional}" + } + + return "object{}" + + case "string", "integer", "number", "boolean": + return propType + + default: + if propType == "" { + if _, hasProps := propMap["properties"]; hasProps { + return "implicit-object" + } + if _, hasItems := propMap["items"]; hasItems { + return "implicit-array" + } + } + return fmt.Sprintf("type:%s", propType) + } +} + +// Describe the structural difference for reporting/debugging +func describeStructuralDifference(entityProp, requestProp interface{}) string { + entityStructure := getPropertyStructure(entityProp) + requestStructure := getPropertyStructure(requestProp) + return fmt.Sprintf("request structure '%s' != response structure '%s'", requestStructure, entityStructure) +} + +func detectCRUDInconsistencies(resources map[string]*ResourceInfo, spec OpenAPISpec) map[string][]CRUDInconsistency { + inconsistencies := make(map[string][]CRUDInconsistency) + + specData, err := json.Marshal(spec) + if err != nil { + return inconsistencies + } + + var rawSpec map[string]interface{} + if err := json.Unmarshal(specData, &rawSpec); err != nil { + return inconsistencies + } + + components, _ := rawSpec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + requiredFieldsMap := make(map[string]map[string]bool) + for _, resource := range resources { + requiredFields := make(map[string]bool) + + if resource.CreateSchema != "" { + if createSchema, ok := schemas[resource.CreateSchema].(map[string]interface{}); ok { + if required, ok := createSchema["required"].([]interface{}); ok { + for _, field := range required { + if fieldName, ok := field.(string); ok { + requiredFields[fieldName] = true + } + } + } + } + } + requiredFieldsMap[resource.EntityName] = requiredFields + } + + for _, resource := range resources { + requiredFields := requiredFieldsMap[resource.EntityName] + resourceInconsistencies := detectSchemaPropertyInconsistencies(resource, schemas, requiredFields) + + // Check if we have fundamental validation errors that make the resource non-viable + for _, inconsistency := range resourceInconsistencies { + if inconsistency.PropertyName == "RESOURCE_VALIDATION" { + fmt.Printf("⚠️ Resource %s (%s) validation failed: %s\n", + resource.ResourceName, resource.EntityName, inconsistency.Description) + // Mark the entire resource as having issues but don't add to inconsistencies + // as this will be handled in the viability check + continue + } + } + + // Only add property-level inconsistencies for viable resources + var validInconsistencies []CRUDInconsistency + for _, inconsistency := range resourceInconsistencies { + if inconsistency.PropertyName != "RESOURCE_VALIDATION" { + validInconsistencies = append(validInconsistencies, inconsistency) + } + } + + if len(validInconsistencies) > 0 { + inconsistencies[resource.EntityName] = validInconsistencies + } + } + + return inconsistencies +} + +// Detect schema property inconsistencies (simplified CRUD detection) +func detectSchemaPropertyInconsistencies(resource *ResourceInfo, schemas map[string]interface{}, requiredFields map[string]bool) []CRUDInconsistency { + var inconsistencies []CRUDInconsistency + + // First, validate that we have the minimum required operations for Terraform + _, hasCreate := resource.Operations["create"] // in absence of a POST operation, PUT operations are registered as create + _, hasRead := resource.Operations["read"] + + if !hasCreate || !hasRead { + // Return a fundamental inconsistency - resource is not viable for Terraform + inconsistency := CRUDInconsistency{ + PropertyName: "RESOURCE_VALIDATION", + InconsistencyType: "missing-required-operations", + Description: fmt.Sprintf("Resource missing required operations: Create=%v, Read=%v", hasCreate, hasRead), + SchemasToIgnore: []string{}, // Don't ignore anything, this makes the whole resource invalid since Terraform needs a create and a read, at minimum + } + return []CRUDInconsistency{inconsistency} + } + + if resource.CreateSchema == "" { + inconsistency := CRUDInconsistency{ + PropertyName: "RESOURCE_VALIDATION", + InconsistencyType: "missing-create-schema", + Description: "Resource has CREATE operation but no request schema defined", + SchemasToIgnore: []string{}, + } + return []CRUDInconsistency{inconsistency} + } + + entityProps := getSchemaProperties(schemas, resource.EntityName) + createProps := getSchemaProperties(schemas, resource.CreateSchema) + updateProps := map[string]interface{}{} + + if resource.UpdateSchema != "" { + updateProps = getSchemaProperties(schemas, resource.UpdateSchema) + } + + // Validate that schemas exist and have properties + if len(entityProps) == 0 { + inconsistency := CRUDInconsistency{ + PropertyName: "RESOURCE_VALIDATION", + InconsistencyType: "invalid-entity-schema", + Description: fmt.Sprintf("Entity schema '%s' not found or has no properties", resource.EntityName), + SchemasToIgnore: []string{}, + } + return []CRUDInconsistency{inconsistency} + } + + if len(createProps) == 0 { + inconsistency := CRUDInconsistency{ + PropertyName: "RESOURCE_VALIDATION", + InconsistencyType: "invalid-create-schema", + Description: fmt.Sprintf("Create schema '%s' not found or has no properties", resource.CreateSchema), + SchemasToIgnore: []string{}, + } + return []CRUDInconsistency{inconsistency} + } + + // Check for minimum viable overlap between create and entity schemas + commonManageableProps := 0 + createManageableProps := 0 + + for prop := range createProps { + if !isSystemProperty(prop) { + createManageableProps++ + if entityProps[prop] != nil { + commonManageableProps++ + } + } + } + + // Need at least some managable properties + // if there is aleast one common manageable property, we won't rule it out at this stage + if createManageableProps == 0 { + inconsistency := CRUDInconsistency{ + PropertyName: "RESOURCE_VALIDATION", + InconsistencyType: "no-manageable-properties", + Description: "Create schema has no manageable properties (all are system properties)", + SchemasToIgnore: []string{}, + } + return []CRUDInconsistency{inconsistency} + } + + // Now check individual property inconsistencies for viable resources + // Collect all property names across CRUD operations + allProps := make(map[string]bool) + for prop := range entityProps { + allProps[prop] = true + } + for prop := range createProps { + allProps[prop] = true + } + for prop := range updateProps { + allProps[prop] = true + } + + // Check each property for consistency across CRUD operations + for propName := range allProps { + // Skip ID properties - they have separate handling logic + if propName == "id" { + continue + } + + if requiredFields[propName] { + // Skip required fields - they should already be handled in normalization + continue + } + + entityHas := entityProps[propName] != nil + createHas := createProps[propName] != nil + updateHas := updateProps[propName] != nil + + // Check for CRUD inconsistencies + var schemasToIgnore []string + var inconsistencyType string + var description string + hasInconsistency := false + + if resource.CreateSchema != "" && resource.UpdateSchema != "" { + // Full CRUD resource - all three must be consistent + if !(entityHas && createHas && updateHas) { + hasInconsistency = true + inconsistencyType = "crud-property-mismatch" + description = fmt.Sprintf("Property not present in all CRUD operations (Entity:%v, Create:%v, Update:%v)", entityHas, createHas, updateHas) + + // Ignore in schemas where property exists but shouldn't for consistency + if entityHas && (!createHas || !updateHas) { + schemasToIgnore = append(schemasToIgnore, resource.EntityName) + } + if createHas && (!entityHas || !updateHas) { + schemasToIgnore = append(schemasToIgnore, resource.CreateSchema) + } + if updateHas && (!entityHas || !createHas) { + schemasToIgnore = append(schemasToIgnore, resource.UpdateSchema) + } + } + } else if resource.CreateSchema != "" { + // Create + Read resource - both must be consistent + if !(entityHas && createHas) { + hasInconsistency = true + inconsistencyType = "create-read-mismatch" + description = fmt.Sprintf("Property not present in both CREATE and READ (Entity:%v, Create:%v)", entityHas, createHas) + + if entityHas && !createHas { + schemasToIgnore = append(schemasToIgnore, resource.EntityName) + } + if createHas && !entityHas { + schemasToIgnore = append(schemasToIgnore, resource.CreateSchema) + } + } + } + + if hasInconsistency { + inconsistency := CRUDInconsistency{ + PropertyName: propName, + InconsistencyType: inconsistencyType, + Description: description, + SchemasToIgnore: schemasToIgnore, + } + inconsistencies = append(inconsistencies, inconsistency) + } + } + + return inconsistencies +} + +// isComputedField checks if a field name appears to be computed/readonly +func isComputedField(fieldName string) bool { + // Most of these are specific to runbook steps + computedPatterns := []string{ + "created_at", "updated_at", "created_by", "updated_by", + "is_editable", "votes", "categories", "runbook_template_id", + "action_elements", "step_elements", "automatic", "repeats", + "repeats_duration", "delay_duration", "reruns", + } + + lowerField := strings.ToLower(fieldName) + for _, pattern := range computedPatterns { + if lowerField == pattern || strings.HasSuffix(lowerField, "_"+pattern) { + return true + } + } + + return false +} + +// detectReadonlyFields finds fields that exist only in response and marks them readonly +func detectReadonlyFields(entityName string, entitySchema, createSchema, updateSchema map[string]interface{}, + schemas map[string]interface{}) []OverlayAction { + + var actions []OverlayAction + + entityProps, _ := entitySchema["properties"].(map[string]interface{}) + createProps := make(map[string]interface{}) + updateProps := make(map[string]interface{}) + + if createSchema != nil { + createProps, _ = createSchema["properties"].(map[string]interface{}) + } + if updateSchema != nil { + updateProps, _ = updateSchema["properties"].(map[string]interface{}) + } + + for propName, entityProp := range entityProps { + _, inCreate := createProps[propName] + _, inUpdate := updateProps[propName] + + // If not in any request schema, it's readonly + if !inCreate && !inUpdate { + // Skip if it's a system field that we expect to be readonly + if propName == "id" || propName == "slug" { + continue + } + + actions = append(actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", entityName, propName), + Update: map[string]interface{}{ + "x-speakeasy-param-readonly": true, + }, + }) + + // For nested objects, mark their properties as readonly too + if entityPropMap, ok := entityProp.(map[string]interface{}); ok { + if nestedProps, ok := entityPropMap["properties"].(map[string]interface{}); ok { + for nestedPropName := range nestedProps { + actions = append(actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s.properties.%s", + entityName, propName, nestedPropName), + Update: map[string]interface{}{ + "x-speakeasy-param-readonly": true, + }, + }) + } + } + } + } else { + // Property exists in request - check nested properties for partial readonly + actions = append(actions, detectNestedReadonlyFields(entityName, propName, + entityProp, createProps[propName], updateProps[propName], schemas)...) + } + } + + return actions +} + +// detectNestedReadonlyFields checks for readonly nested properties within manageable fields +func detectNestedReadonlyFields(entityName, propName string, entityProp, createProp, updateProp interface{}, + schemas map[string]interface{}) []OverlayAction { + + var actions []OverlayAction + + // Resolve any refs + entityResolved, _ := common.GetResolvedPropertyType(entityProp, schemas) + createResolved, _ := common.GetResolvedPropertyType(createProp, schemas) + updateResolved, _ := common.GetResolvedPropertyType(updateProp, schemas) + + // For objects, check nested properties + if entityResolved != nil && entityResolved["type"] == "object" { + entityNestedProps, _ := entityResolved["properties"].(map[string]interface{}) + createNestedProps := make(map[string]interface{}) + updateNestedProps := make(map[string]interface{}) + + if createResolved != nil { + createNestedProps, _ = createResolved["properties"].(map[string]interface{}) + } + if updateResolved != nil { + updateNestedProps, _ = updateResolved["properties"].(map[string]interface{}) + } + + // Check each nested property + for nestedPropName := range entityNestedProps { + _, inCreate := createNestedProps[nestedPropName] + _, inUpdate := updateNestedProps[nestedPropName] + + if !inCreate && !inUpdate { + actions = append(actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s.properties.%s", + entityName, propName, nestedPropName), + Update: map[string]interface{}{ + "x-speakeasy-param-readonly": true, + }, + }) + } + } + } + + // For arrays of objects, check item properties + if entityResolved != nil && entityResolved["type"] == "array" { + if items, ok := entityResolved["items"].(map[string]interface{}); ok { + if itemProps, ok := items["properties"].(map[string]interface{}); ok { + // Get request item properties + createItemProps := make(map[string]interface{}) + updateItemProps := make(map[string]interface{}) + + if createResolved != nil { + if createItems, ok := createResolved["items"].(map[string]interface{}); ok { + createItemProps, _ = createItems["properties"].(map[string]interface{}) + } + } + if updateResolved != nil { + if updateItems, ok := updateResolved["items"].(map[string]interface{}); ok { + updateItemProps, _ = updateItems["properties"].(map[string]interface{}) + } + } + + // Check each item property + for itemPropName := range itemProps { + _, inCreate := createItemProps[itemPropName] + _, inUpdate := updateItemProps[itemPropName] + + if !inCreate && !inUpdate || isComputedField(itemPropName) { + actions = append(actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s.items.properties.%s", + entityName, propName, itemPropName), + Update: map[string]interface{}{ + "x-speakeasy-param-readonly": true, + }, + }) + } + } + } + } + } + + return actions +} + +// shouldSkipIgnore checks if we should skip adding x-speakeasy-ignore for a property +// because it has been normalized and is now manageable +func shouldSkipIgnore(entityName, propName string, resources map[string]*ResourceInfo, + spec OpenAPISpec) bool { + + // Get the resource info + var resource *ResourceInfo + for _, res := range resources { + if res.EntityName == entityName { + resource = res + break + } + } + + if resource == nil { + return false + } + + // Convert spec to raw format for analysis + specData, _ := json.Marshal(spec) + var rawSpec map[string]interface{} + json.Unmarshal(specData, &rawSpec) + components, _ := rawSpec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + // Get schemas + entitySchema, _ := schemas[entityName].(map[string]interface{}) + createSchema, _ := schemas[resource.CreateSchema].(map[string]interface{}) + updateSchema, _ := schemas[resource.UpdateSchema].(map[string]interface{}) + + // Check if property exists in entity + entityProps, _ := entitySchema["properties"].(map[string]interface{}) + entityProp, existsInEntity := entityProps[propName] + if !existsInEntity { + return false + } + + // Check if property exists in request schemas + existsInCreate := false + existsInUpdate := false + + if createSchema != nil { + createProps, _ := createSchema["properties"].(map[string]interface{}) + _, existsInCreate = createProps[propName] + } + + if updateSchema != nil { + updateProps, _ := updateSchema["properties"].(map[string]interface{}) + _, existsInUpdate = updateProps[propName] + } + + if existsInCreate || existsInUpdate { + if entityProp != nil { + return true // Assume normalized properties shouldn't be ignored + } + } + + return false +} diff --git a/scripts/overlay/generate-overlay.go b/scripts/overlay/generate-overlay.go new file mode 100644 index 0000000..78fe187 --- /dev/null +++ b/scripts/overlay/generate-overlay.go @@ -0,0 +1,306 @@ +package main + +import ( + "encoding/json" + "fmt" + "strings" +) + +type OverlayAction struct { + Target string `yaml:"target"` + Update map[string]interface{} `yaml:"update,omitempty"` +} + +type Overlay struct { + Overlay string `yaml:"overlay"` + Info struct { + Title string `yaml:"title"` + Version string `yaml:"version"` + Description string `yaml:"description"` + } `yaml:"info"` + Actions []OverlayAction `yaml:"actions"` +} + +func generateOverlay(resources map[string]*ResourceInfo, spec OpenAPISpec, manualMappings *ManualMappings) *Overlay { + overlay := &Overlay{ + Overlay: "1.0.0", + } + + overlay.Info.Title = "Terraform Provider Overlay" + overlay.Info.Version = "1.0.0" + overlay.Info.Description = "Auto-generated overlay for Terraform resources" + + // Clean up resources by removing manually ignored operations + + // In general, we don't need to alter the spec at this point + // We can simply not apply x-speakeasy extentions to these entities + // Without the extensions, they will not be registered in the Terraform provider + cleanedResources := applyManualMappings(resources, manualMappings) + + viableResources := make(map[string]*ResourceInfo) + skippedResources := make([]string, 0) + + for name, resource := range cleanedResources { + if isTerraformViable(resource, spec) { + viableResources[name] = resource + } else { + skippedResources = append(skippedResources, name) + } + } + + fmt.Printf("\n=== Overlay Generation Analysis ===\n") + fmt.Printf("Resources after Manual Mappings: %d\n", len(cleanedResources)) + fmt.Printf("Viable for Terraform: %d\n", len(viableResources)) + fmt.Printf("Skipped (non-viable): %d\n", len(skippedResources)) + + overlay.Info.Description = fmt.Sprintf("Auto-generated overlay for %d viable Terraform resources", len(viableResources)) + + specData, _ := json.Marshal(spec) + var rawSpec map[string]interface{} + json.Unmarshal(specData, &rawSpec) + components, _ := rawSpec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + resourceMismatches := detectPropertyMismatches(viableResources, spec) + resourceCRUDInconsistencies := detectCRUDInconsistencies(viableResources, spec) + + ignoreTracker := make(map[string]map[string]bool) + readonlyTracker := make(map[string]map[string]bool) + + requiredFieldsMap := make(map[string]map[string]bool) + for _, resource := range viableResources { + requiredFields := make(map[string]bool) + if resource.CreateSchema != "" { + if createSchema, ok := schemas[resource.CreateSchema].(map[string]interface{}); ok { + if required, ok := createSchema["required"].([]interface{}); ok { + for _, field := range required { + if fieldName, ok := field.(string); ok { + requiredFields[fieldName] = true + } + } + } + } + } + requiredFieldsMap[resource.EntityName] = requiredFields + } + + for _, resource := range viableResources { + entityUpdate := map[string]interface{}{ + "x-speakeasy-entity": resource.EntityName, + } + + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s", resource.SchemaName), + Update: entityUpdate, + }) + + if ignoreTracker[resource.EntityName] == nil { + ignoreTracker[resource.EntityName] = make(map[string]bool) + } + if readonlyTracker[resource.EntityName] == nil { + readonlyTracker[resource.EntityName] = make(map[string]bool) + } + if resource.CreateSchema != "" && ignoreTracker[resource.CreateSchema] == nil { + ignoreTracker[resource.CreateSchema] = make(map[string]bool) + } + if resource.UpdateSchema != "" && ignoreTracker[resource.UpdateSchema] == nil { + ignoreTracker[resource.UpdateSchema] = make(map[string]bool) + } + + requiredFields := requiredFieldsMap[resource.EntityName] + + entitySchema, _ := schemas[resource.EntityName].(map[string]interface{}) + var createSchema map[string]interface{} + var updateSchema map[string]interface{} + + if resource.CreateSchema != "" { + createSchema, _ = schemas[resource.CreateSchema].(map[string]interface{}) + } + if resource.UpdateSchema != "" { + updateSchema, _ = schemas[resource.UpdateSchema].(map[string]interface{}) + } + + readonlyActions := detectReadonlyFields(resource.EntityName, entitySchema, createSchema, updateSchema, schemas) + for _, action := range readonlyActions { + // Extract property name from target for tracking + parts := strings.Split(action.Target, ".") + if len(parts) >= 4 && parts[len(parts)-2] == "properties" { + propName := parts[len(parts)-1] + if !readonlyTracker[resource.EntityName][propName] { + overlay.Actions = append(overlay.Actions, action) + readonlyTracker[resource.EntityName][propName] = true + } + } + } + + // Handle mismatches - but skip if property was normalized + if mismatches, exists := resourceMismatches[resource.EntityName]; exists { + for _, mismatch := range mismatches { + // Check if this property should be skipped (was normalized) + if shouldSkipIgnore(resource.EntityName, mismatch.PropertyName, viableResources, spec) { + continue + } + + if requiredFields[mismatch.PropertyName] { + if resource.CreateSchema != "" { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", + resource.CreateSchema, mismatch.PropertyName), + Update: map[string]interface{}{ + "x-speakeasy-param-optional": true, + }, + }) + } + } else { + addIgnoreActionsForMismatches(overlay, resource, []PropertyMismatch{mismatch}, ignoreTracker) + } + } + } + + if inconsistencies, exists := resourceCRUDInconsistencies[resource.EntityName]; exists { + for _, inconsistency := range inconsistencies { + if shouldSkipIgnore(resource.EntityName, inconsistency.PropertyName, viableResources, spec) { + continue + } + + if requiredFields[inconsistency.PropertyName] { + if resource.CreateSchema != "" { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", + resource.CreateSchema, inconsistency.PropertyName), + Update: map[string]interface{}{ + "x-speakeasy-param-optional": true, + }, + }) + } + } else { + addIgnoreActionsForInconsistencies(overlay, []CRUDInconsistency{inconsistency}, ignoreTracker) + } + } + } + + for crudType, opInfo := range resource.Operations { + if shouldIgnoreOperation(opInfo.Path, opInfo.Method, manualMappings) { + continue + } + + entityOp := mapCrudToEntityOperation(crudType, resource.EntityName) + + operationUpdate := map[string]interface{}{ + "x-speakeasy-entity-operation": entityOp, + } + + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.paths[\"%s\"].%s", opInfo.Path, opInfo.Method), + Update: operationUpdate, + }) + + if resource.PrimaryID != "" && (crudType == "read" || crudType == "update" || crudType == "delete") { + pathParams := extractPathParameters(opInfo.Path) + for _, param := range pathParams { + if param == resource.PrimaryID { + if manualMatch, hasManual := getManualParameterMatch(opInfo.Path, opInfo.Method, param, manualMappings); hasManual { + if manualMatch != param { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.paths[\"%s\"].%s.parameters[?(@.name==\"%s\")]", + opInfo.Path, opInfo.Method, param), + Update: map[string]interface{}{ + "x-speakeasy-match": manualMatch, + }, + }) + } + } else { + var targetField string + + // Don't create circular mappings + if param == "id" || param == "slug" { + continue + } + + // Get entity properties to check what fields exist + entityProps := getEntityProperties(resource.EntityName, spec) + _, hasID := entityProps["id"] + _, hasSlug := entityProps["slug"] + + // Determine the target field based on parameter name and entity fields + if strings.HasSuffix(param, "_slug") && hasSlug { + targetField = "slug" + } else if strings.Contains(param, "slug") && hasSlug && !hasID { + targetField = "slug" + } else if strings.HasSuffix(param, "_id") && hasID { + targetField = "id" + } else if hasID { + targetField = "id" + } else if hasSlug { + targetField = "slug" + } else { + fmt.Printf(" Warning: Cannot map parameter %s - entity has neither id nor slug field\n", param) + continue + } + + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.paths[\"%s\"].%s.parameters[?(@.name==\"%s\")]", + opInfo.Path, opInfo.Method, param), + Update: map[string]interface{}{ + "x-speakeasy-match": targetField, + }, + }) + } + } + } + } + } + } + + manualPropertyIgnores := getManualPropertyIgnores(manualMappings) + for schemaName, properties := range manualPropertyIgnores { + for _, propertyName := range properties { + // Initialize ignore tracker if needed + if ignoreTracker[schemaName] == nil { + ignoreTracker[schemaName] = make(map[string]bool) + } + + // Only add if not already ignored + if !ignoreTracker[schemaName][propertyName] { + overlay.Actions = append(overlay.Actions, OverlayAction{ + Target: fmt.Sprintf("$.components.schemas.%s.properties.%s", schemaName, propertyName), + Update: map[string]interface{}{ + "x-speakeasy-ignore": true, + }, + }) + ignoreTracker[schemaName][propertyName] = true + fmt.Printf("✅ Added manual property ignore: %s.%s\n", schemaName, propertyName) + } + } + } + + fmt.Printf("\n=== Overlay Generation Complete ===\n") + fmt.Printf("Generated %d actions for %d viable resources\n", len(overlay.Actions), len(viableResources)) + + totalIgnores := 0 + totalMatches := 0 + totalReadonly := 0 + for _, action := range overlay.Actions { + if _, hasIgnore := action.Update["x-speakeasy-ignore"]; hasIgnore { + totalIgnores++ + } + if _, hasMatch := action.Update["x-speakeasy-match"]; hasMatch { + totalMatches++ + } + if _, hasReadonly := action.Update["x-speakeasy-param-readonly"]; hasReadonly { + totalReadonly++ + } + } + + if totalIgnores > 0 { + fmt.Printf("✅ %d speakeasy ignore actions added for unresolved property issues\n", totalIgnores) + } + if totalMatches > 0 { + fmt.Printf("✅ %d speakeasy match actions added for primary ID parameters\n", totalMatches) + } + if totalReadonly > 0 { + fmt.Printf("✅ %d speakeasy readonly actions added for computed fields\n", totalReadonly) + } + + return overlay +} diff --git a/scripts/overlay/link-entity-operations.go b/scripts/overlay/link-entity-operations.go new file mode 100644 index 0000000..433e639 --- /dev/null +++ b/scripts/overlay/link-entity-operations.go @@ -0,0 +1,46 @@ +package main + +import "strings" + +func mapCrudToEntityOperation(crudType, entityName string) string { + switch crudType { + case "create": + return entityName + "#create" + case "read": + return entityName + "#read" + case "update": + return entityName + "#update" + case "delete": + return entityName + "#delete" + case "list": + // For list operations, pluralize the entity name and use #read + pluralEntityName := pluralizeEntityName(entityName) + return pluralEntityName + "#read" + default: + return entityName + "#" + crudType + } +} + +func pluralizeEntityName(entityName string) string { + baseName := strings.TrimSuffix(entityName, "Entity") + + if strings.HasSuffix(baseName, "y") && len(baseName) > 1 && !isVowel(baseName[len(baseName)-2]) { + baseName = baseName[:len(baseName)-1] + "ies" + } else if strings.HasSuffix(baseName, "s") || + strings.HasSuffix(baseName, "ss") || + strings.HasSuffix(baseName, "sh") || + strings.HasSuffix(baseName, "ch") || + strings.HasSuffix(baseName, "x") || + strings.HasSuffix(baseName, "z") { + baseName = baseName + "es" + } else { + baseName = baseName + "s" + } + + return baseName + "Entities" +} + +func isVowel(c byte) bool { + return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || + c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' +} diff --git a/scripts/overlay/main.go b/scripts/overlay/main.go new file mode 100644 index 0000000..406495b --- /dev/null +++ b/scripts/overlay/main.go @@ -0,0 +1,164 @@ +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + + "gopkg.in/yaml.v3" +) + +type OpenAPISpec struct { + OpenAPI string `json:"openapi"` + Info map[string]interface{} `json:"info"` + Paths map[string]PathItem `json:"paths"` + Components Components `json:"components"` +} + +type Components struct { + Schemas map[string]Schema `json:"schemas"` + SecuritySchemes map[string]interface{} `json:"securitySchemes,omitempty"` +} + +type Schema struct { + Type string `json:"type,omitempty"` + Properties map[string]interface{} `json:"properties,omitempty"` + Required []string `json:"required,omitempty"` + AllOf []interface{} `json:"allOf,omitempty"` + Nullable bool `json:"nullable,omitempty"` + Items interface{} `json:"items,omitempty"` + Raw map[string]interface{} `json:"-"` +} + +type PathItem struct { + Get *Operation `json:"get,omitempty"` + Post *Operation `json:"post,omitempty"` + Put *Operation `json:"put,omitempty"` + Patch *Operation `json:"patch,omitempty"` + Delete *Operation `json:"delete,omitempty"` +} + +type Operation struct { + OperationID string `json:"operationId,omitempty"` + Tags []string `json:"tags,omitempty"` + Parameters []Parameter `json:"parameters,omitempty"` + RequestBody map[string]interface{} `json:"requestBody,omitempty"` + Responses map[string]interface{} `json:"responses,omitempty"` +} + +type Parameter struct { + Name string `json:"name"` + In string `json:"in"` + Required bool `json:"required,omitempty"` + Schema Schema `json:"schema,omitempty"` +} + +func main() { + if len(os.Args) < 2 { + printUsage() + os.Exit(1) + } + + specPath := os.Args[1] + var mappingsPath string + if len(os.Args) > 2 { + mappingsPath = os.Args[2] + } else { + mappingsPath = "manual-mappings.yaml" + } + + fmt.Printf("=== Terraform Overlay Generator ===\n") + fmt.Printf("Input: %s\n", specPath) + + manualMappings := loadManualMappings(mappingsPath) + + specData, err := ioutil.ReadFile(specPath) + if err != nil { + fmt.Printf("Error reading spec file: %v\n", err) + os.Exit(1) + } + + var spec OpenAPISpec + if err := json.Unmarshal(specData, &spec); err != nil { + fmt.Printf("Error parsing JSON: %v\n", err) + os.Exit(1) + } + + fmt.Printf("Found %d paths and %d schemas\n\n", len(spec.Paths), len(spec.Components.Schemas)) + + resources := analyzeSpec(spec, manualMappings) + + overlay := generateOverlay(resources, spec, manualMappings) + + if err := writeOverlay(overlay); err != nil { + fmt.Printf("Error writing overlay: %v\n", err) + os.Exit(1) + } + + printOverlaySummary(overlay) +} + +func printUsage() { + fmt.Println("OpenAPI Terraform Overlay Generator") + fmt.Println() + fmt.Println("Usage:") + fmt.Println(" openapi-overlay ") +} + +func (s *Schema) UnmarshalJSON(data []byte) error { + type Alias Schema + aux := &struct { + *Alias + }{ + Alias: (*Alias)(s), + } + + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + + // Also unmarshal into raw map + if err := json.Unmarshal(data, &s.Raw); err != nil { + return err + } + + return nil +} + +func writeOverlay(overlay *Overlay) error { + data, err := yaml.Marshal(overlay) + if err != nil { + return fmt.Errorf("marshaling overlay: %w", err) + } + + overlayPath := "terraform-overlay.yaml" + if err := ioutil.WriteFile(overlayPath, data, 0644); err != nil { + return fmt.Errorf("writing overlay file: %w", err) + } + + fmt.Printf("Overlay written to: %s\n", overlayPath) + return nil +} + +func printOverlaySummary(overlay *Overlay) { + fmt.Println("\n=== Summary ===") + fmt.Printf("✅ Successfully generated overlay with %d actions\n", len(overlay.Actions)) + + fmt.Println("\nOverlay approach:") + fmt.Println("1. Load manual mappings for edge cases") + fmt.Println("2. Identify entity schemas and match operations to entities") + fmt.Println("3. Apply manual ignore/entity/match mappings during analysis") + fmt.Println("4. Clean resources by removing manually ignored operations") + fmt.Println("5. Analyze ID patterns and choose consistent primary ID per entity") + fmt.Println("6. Filter operations with unmappable path parameters") + fmt.Println("7. Skip annotations for non-viable resources") + fmt.Println("8. Mark viable entity schemas with x-speakeasy-entity") + fmt.Println("9. Tag viable operations with x-speakeasy-entity-operation") + fmt.Println("10. Mark chosen primary ID with x-speakeasy-match") + fmt.Println("11. Detect properties normalized during normalization phase") + fmt.Println("12. Mark response-only fields with x-speakeasy-param-readonly") + fmt.Println("13. Detect nested readonly properties within manageable fields") + fmt.Println("14. Apply x-speakeasy-ignore only to unresolved structural mismatches") + fmt.Println("15. Apply manual property ignores from mappings") +} diff --git a/scripts/overlay/manual-mappings.go b/scripts/overlay/manual-mappings.go new file mode 100644 index 0000000..a760af2 --- /dev/null +++ b/scripts/overlay/manual-mappings.go @@ -0,0 +1,122 @@ +package main + +import ( + "fmt" + "io/ioutil" + "strings" + + "gopkg.in/yaml.v3" +) + +// Manual mapping configuration, corresponds with the manual-mappings.yaml file +type ManualMapping struct { + Path string `yaml:"path"` + Method string `yaml:"method"` + Action string `yaml:"action"` // "ignore", "entity", "match" + Value string `yaml:"value,omitempty"` + + // For entity mappings + Schema string `yaml:"schema,omitempty"` + Property string `yaml:"property,omitempty"` +} + +type ManualMappings struct { + Operations []ManualMapping `yaml:"operations"` +} + +func loadManualMappings(mappingsPath string) *ManualMappings { + data, err := ioutil.ReadFile(mappingsPath) + if err != nil { + // File doesn't exist - return empty mappings + fmt.Printf("No manual mappings file found at %s (this is optional)\n", mappingsPath) + return &ManualMappings{} + } + + var mappings ManualMappings + if err := yaml.Unmarshal(data, &mappings); err != nil { + fmt.Printf("Error parsing manual mappings file: %v\n", err) + return &ManualMappings{} + } + + return &mappings +} + +func applyManualMappings(resources map[string]*ResourceInfo, manualMappings *ManualMappings) map[string]*ResourceInfo { + cleanedResources := make(map[string]*ResourceInfo) + + fmt.Printf("\n=== Cleaning Resources with Manual Mappings ===\n") + + for name, resource := range resources { + cleanedResource := &ResourceInfo{ + EntityName: resource.EntityName, + SchemaName: resource.SchemaName, + ResourceName: resource.ResourceName, + Operations: make(map[string]OperationInfo), + CreateSchema: resource.CreateSchema, + UpdateSchema: resource.UpdateSchema, + PrimaryID: resource.PrimaryID, + } + + operationsRemoved := 0 + + for crudType, opInfo := range resource.Operations { + if shouldIgnoreOperation(opInfo.Path, opInfo.Method, manualMappings) { + operationsRemoved++ + } else { + cleanedResource.Operations[crudType] = opInfo + } + } + + if len(cleanedResource.Operations) > 0 { + cleanedResources[name] = cleanedResource + if operationsRemoved > 0 { + } + } + } + + fmt.Printf("Manual mapping cleanup: %d → %d resources\n", len(resources), len(cleanedResources)) + return cleanedResources +} + +func getManualParameterMatch(path, method, paramName string, manualMappings *ManualMappings) (string, bool) { + for _, mapping := range manualMappings.Operations { + if mapping.Path == path && strings.EqualFold(mapping.Method, method) && mapping.Action == "match" { + parts := strings.SplitN(mapping.Value, ":", 2) + if len(parts) == 2 && parts[0] == paramName { + return parts[1], true + } + } + } + return "", false +} + +func shouldIgnoreOperation(path, method string, manualMappings *ManualMappings) bool { + for _, mapping := range manualMappings.Operations { + if mapping.Path == path && strings.EqualFold(mapping.Method, method) && mapping.Action == "ignore" { + return true + } + } + return false +} + +func getManualEntityMapping(path, method string, manualMappings *ManualMappings) (string, bool) { + for _, mapping := range manualMappings.Operations { + if mapping.Path == path && strings.EqualFold(mapping.Method, method) && mapping.Action == "entity" { + return mapping.Value, true + } + } + return "", false +} + +func getManualPropertyIgnores(manualMappings *ManualMappings) map[string][]string { + ignores := make(map[string][]string) + + for _, mapping := range manualMappings.Operations { + if mapping.Action == "ignore_property" && mapping.Schema != "" && mapping.Property != "" { + fmt.Printf(" Manual property ignore: %s.%s\n", mapping.Schema, mapping.Property) + ignores[mapping.Schema] = append(ignores[mapping.Schema], mapping.Property) + } + } + + return ignores +} diff --git a/scripts/overlay/manual-mappings.yaml b/scripts/overlay/manual-mappings.yaml new file mode 100644 index 0000000..819381c --- /dev/null +++ b/scripts/overlay/manual-mappings.yaml @@ -0,0 +1,115 @@ +# Action types: +# - "ignore": Skip this operation entirely (won't get any x-speakeasy annotations) +# - "entity": Force operation to map to specific entity (value = entity name) +# - "match": Override parameter mapping (value = "param_name:field_name") +# - "ignore_property": Ignore a specific property on an entity, specify schema and property + +operations: + # IGNORE: Skip operations that shouldn't be treated as entity operations + # Contains a parameter we cannot reconcile across entity operations + - path: "/v1/incidents/{incident_id}/impact" + method: "patch" + action: "ignore" + - path: "v1/incidents/{incident_id}/resolve" + method: "put" + action: "ignore" + - path: "/v1/incidents/{incident_id}/impact" + method: "put" + action: "ignore" + + # Resource type path params are causing issues with entity resolution + # TODO: Figure out how to include + # Terraform propably doesn't need this + # but the pattern isn't that odd so this could easily reappear + - path: /v1/saved_searches/{resource_type}/{saved_search_id}"" + method: "delete" + action: "ignore" + - path: /v1/saved_searches/{resource_type}/{saved_search_id}" + method: "get" + action: "ignore" + - path: "/v1/saved_searches/{resource_type}/{saved_search_id}" + method: "patch" + action: "ignore" + - path: "/v1/saved_searches/{resource_type}" + method: "post" + action: "ignore" + - path: "/v1/saved_searches/{resource_type}" + method: "get" + action: "ignore" + + # The template Property on this entity causes collision with the incidents type template + # TODO: Figure out why this is happening + - path: + + # Manual Entity Mappings + # Signals Event Sources + - path: "/v1/signals/event_sources/{transposer_slug}" + method: "get" + action: "entity" + value: "Signals_API_TransposerEntity" + + - path: "/v1/signals/event_sources" + method: "put" + action: "entity" + value: "Signals_API_TransposerEntity" + + - path: "/v1/signals/event_sources/{transposer_slug}" + method: "delete" + action: "entity" + value: "Signals_API_TransposerEntity" + + - path: "/v1/signals/event_sources" + method: "get" + action: "entity" + value: "Signals_API_TransposerEntity" + + # Parameter matching for transposer_slug -> slug field + - path: "/v1/signals/event_sources/{transposer_slug}" + method: "get" + action: "match" + value: "transposer_slug:slug" + + - path: "/v1/signals/event_sources/{transposer_slug}" + method: "delete" + action: "match" + value: "transposer_slug:slug" + +# Signals Alert Grouping + - path: "/v1/signals/grouping" + method: "get" + action: "entity" + value: "Signals_API_GroupingEntity" + + - path: "/v1/signals/grouping" + method: "post" + action: "entity" + value: "Signals_API_GroupingEntity" + + - path: "/v1/signals/grouping/{id}" + method: "get" + action: "entity" + value: "Signals_API_GroupingEntity" + + - path: "/v1/signals/grouping/{id}" + method: "patch" + action: "entity" + value: "Signals_API_GroupingEntity" + + - path: "/v1/signals/grouping/{id}" + method: "delete" + action: "entity" + value: "Signals_API_GroupingEntity" + + +# Entity Level Property Ignoring - only work for top level properties + - action: "ignore_property" + schema: "PublicAPI_V1_FormConfigurations_SelectedValueEntity" + property: "template" + + - action: "ignore_property" + schema: "MediaImageEntity" + property: "versions_urls" + + - action: "ignore_property" + schema: "IncidentTypeEntity_TemplateValuesEntity" + property: "runbooks" \ No newline at end of file diff --git a/scripts/overlay/terraform-viable.go b/scripts/overlay/terraform-viable.go new file mode 100644 index 0000000..7966649 --- /dev/null +++ b/scripts/overlay/terraform-viable.go @@ -0,0 +1,401 @@ +package main + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Check if a resource is viable for Terraform +func isTerraformViable(resource *ResourceInfo, spec OpenAPISpec) bool { + // Must have at least create and read operations + _, hasCreate := resource.Operations["create"] + _, hasRead := resource.Operations["read"] + + if (!hasCreate) || !hasRead { + fmt.Printf(" Missing required operations in %v: Create=%v Read=%v\n", resource.ResourceName, hasCreate, hasRead) + return false + } + + // Must have a create schema to be manageable by Terraform + if resource.CreateSchema == "" { + fmt.Printf(" No create schema found for %v\n", resource.ResourceName) + return false + } + + primaryID, validPrimaryID := identifyEntityPrimaryID(resource, spec) + if !validPrimaryID { + fmt.Printf(" Cannot identify valid primary ID parameter for %v\n", resource.EntityName) + return false + } + + operationsCopy := make(map[string]OperationInfo) + for k, v := range resource.Operations { + operationsCopy[k] = v + } + + // Validate all operations against the primary ID + validOperations := validateOperationParameters(&ResourceInfo{ + EntityName: resource.EntityName, + SchemaName: resource.SchemaName, + ResourceName: resource.ResourceName, + Operations: operationsCopy, + CreateSchema: resource.CreateSchema, + UpdateSchema: resource.UpdateSchema, + PrimaryID: primaryID, + }, primaryID, spec) + + // Must still have CREATE and READ after validation + _, hasValidCreate := validOperations["create"] + _, hasValidRead := validOperations["read"] + + if !hasValidCreate || !hasValidRead { + fmt.Printf(" Lost required operations after parameter validation: Create=%v, Read=%v\n", hasValidCreate, hasValidRead) + return false + } + + // Only update the resource if this is the first validation + if resource.PrimaryID == "" { + resource.Operations = validOperations + resource.PrimaryID = primaryID + } + + // Check for overlapping properties between create and entity schemas + if !hasValidCreateReadConsistency(resource, spec) { + fmt.Printf(" %v Create and Read operations have incompatible schemas\n", resource.EntityName) + return false + } + + // Check for problematic CRUD patterns that can't be handled by property ignoring + if resource.CreateSchema != "" && resource.UpdateSchema != "" { + // Re-parse the spec to get raw schema data for analysis + specData, err := json.Marshal(spec) + if err != nil { + return true // If we can't analyze, assume it's viable + } + + var rawSpec map[string]interface{} + if err := json.Unmarshal(specData, &rawSpec); err != nil { + return true // If we can't analyze, assume it's viable + } + + components, _ := rawSpec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + createProps := getSchemaProperties(schemas, resource.CreateSchema) + updateProps := getSchemaProperties(schemas, resource.UpdateSchema) + + createManageableProps := 0 + updateManageableProps := 0 + commonManageableProps := 0 + + for prop := range createProps { + if !isSystemProperty(prop) { + createManageableProps++ + } + } + + for prop := range updateProps { + if !isSystemProperty(prop) { + updateManageableProps++ + if createProps[prop] != nil && !isSystemProperty(prop) { + commonManageableProps++ + } + } + } + + if createManageableProps <= 1 && updateManageableProps >= 3 && commonManageableProps == 0 { + fmt.Printf(" Incompatible CRUD pattern: Create=%d manageable, Update=%d manageable, Common=%d\n", + createManageableProps, updateManageableProps, commonManageableProps) + return false + } + } + + return true +} + +func validateOperationParameters(resource *ResourceInfo, primaryID string, spec OpenAPISpec) map[string]OperationInfo { + validOperations := make(map[string]OperationInfo) + + entityProps := getEntityProperties(resource.EntityName, spec) + + for crudType, opInfo := range resource.Operations { + pathParams := extractPathParameters(opInfo.Path) + + if crudType == "create" || crudType == "list" { + // These operations should not have the entity's primary ID in path + hasPrimaryID := false + for _, param := range pathParams { + if param == primaryID { + hasPrimaryID = true + break + } + } + + if hasPrimaryID { + fmt.Printf(" Skipping %s operation %s: unexpectedly has primary ID %s in path\n", + crudType, opInfo.Path, primaryID) + continue + } + + validOperations[crudType] = opInfo + continue + } + + hasPrimaryID := false + hasConflictingEntityIDs := false + + // We need to validate that we do not have conflicting ID path parameters + // At time of this comment, we only map a single ID parameter to the corresponding entity id, using x-speakeasy-match + + // If this constraint prevents us from adding resources that customers need/want + // we'll need to figure out how to map additional IDs to right field and entities + // for the time, being, multiple ID params in path are not supported and corresponding operations are ignored, + // unless they are already exact match to the field name on the entity + for _, param := range pathParams { + if param == primaryID { + hasPrimaryID = true + } else if isEntityID(param) { + // This is another ID-like parameter + // Check if it maps to a field in the entity (not the primary id field) + if checkFieldExistsInEntity(param, entityProps) { + // This parameter maps to a real entity field - it's valid + continue + } else { + // This ID parameter doesn't map to any entity field + hasConflictingEntityIDs = true + break + } + } + // Non-ID parameters are always OK + } + + if !hasPrimaryID { + fmt.Printf(" Skipping %s operation %s: missing primary ID %s\n", + crudType, opInfo.Path, primaryID) + continue + } + + if hasConflictingEntityIDs { + fmt.Printf(" Skipping %s operation %s: has conflicting entity ID parameters\n", + crudType, opInfo.Path) + continue + } + + validOperations[crudType] = opInfo + } + + return validOperations +} + +func getEntityProperties(entityName string, spec OpenAPISpec) map[string]interface{} { + specData, err := json.Marshal(spec) + if err != nil { + return map[string]interface{}{} + } + + var rawSpec map[string]interface{} + if err := json.Unmarshal(specData, &rawSpec); err != nil { + return map[string]interface{}{} + } + + components, _ := rawSpec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + return getSchemaProperties(schemas, entityName) +} + +// Check if create and read operations have compatible schemas +// We need to ensure that the create and read operations are exactly the same, after accounting for ignored properties and normalization +func hasValidCreateReadConsistency(resource *ResourceInfo, spec OpenAPISpec) bool { + if resource.CreateSchema == "" { + return false + } + + specData, err := json.Marshal(spec) + if err != nil { + return false + } + + var rawSpec map[string]interface{} + if err := json.Unmarshal(specData, &rawSpec); err != nil { + return false + } + + components, _ := rawSpec["components"].(map[string]interface{}) + schemas, _ := components["schemas"].(map[string]interface{}) + + entityProps := getSchemaProperties(schemas, resource.EntityName) + createProps := getSchemaProperties(schemas, resource.CreateSchema) + + if len(entityProps) == 0 || len(createProps) == 0 { + return false + } + + commonManageableProps := 0 + createManageableProps := 0 + + for prop := range createProps { + if !isSystemProperty(prop) { + createManageableProps++ + if entityProps[prop] != nil { + commonManageableProps++ + } + } + } + + // Need at least some manageable properties + if createManageableProps == 0 { + return false + } + + // If there is any overlap, try to use the schemas + return true +} + +func getSchemaProperties(schemas map[string]interface{}, schemaName string) map[string]interface{} { + if schemaName == "" { + return map[string]interface{}{} + } + + schema, exists := schemas[schemaName] + if !exists { + return map[string]interface{}{} + } + + schemaMap, ok := schema.(map[string]interface{}) + if !ok { + return map[string]interface{}{} + } + + properties, ok := schemaMap["properties"].(map[string]interface{}) + if !ok { + return map[string]interface{}{} + } + + return properties +} + +func isSystemProperty(propName string) bool { + systemProps := []string{ + "id", "created_at", "updated_at", "created_by", "updated_by", + "version", "etag", "revision", "last_modified", + } + + lowerProp := strings.ToLower(propName) + + for _, sysProp := range systemProps { + if lowerProp == sysProp || strings.HasSuffix(lowerProp, "_"+sysProp) { + return true + } + } + + return strings.HasSuffix(lowerProp, "_id") +} + +func checkFieldExistsInEntity(paramName string, entityProps map[string]interface{}) bool { + if _, exists := entityProps[paramName]; exists { + return true + } + + variations := []string{ + paramName, + strings.TrimSuffix(paramName, "_id"), + strings.TrimSuffix(paramName, "Id"), + } + + for _, variation := range variations { + if _, exists := entityProps[variation]; exists { + return true + } + } + + return false +} + +func identifyEntityPrimaryID(resource *ResourceInfo, spec OpenAPISpec) (string, bool) { + allParams := make(map[string]bool) + + for crudType, opInfo := range resource.Operations { + if crudType == "create" || crudType == "list" { + continue + } + + pathParams := extractPathParameters(opInfo.Path) + for _, param := range pathParams { + allParams[param] = true + } + } + + if len(allParams) == 0 { + return "", false + } + + var entityPrimaryID string + matchCount := 0 + + for param := range allParams { + if mapsToEntityID(param, resource.EntityName) { + entityPrimaryID = param + matchCount++ + } + } + + if matchCount == 1 { + return entityPrimaryID, true + } + + entityProps := getEntityProperties(resource.EntityName, spec) + _, hasID := entityProps["id"] + _, hasSlug := entityProps["slug"] + + if hasSlug { + for param := range allParams { + if strings.HasSuffix(param, "_slug") { + return param, true + } + } + + for param := range allParams { + if strings.Contains(strings.ToLower(param), "slug") { + return param, true + } + } + } + + if hasID { + entityBase := strings.ToLower(strings.TrimSuffix(resource.EntityName, "Entity")) + for param := range allParams { + if strings.HasSuffix(param, "_id") { + paramBase := strings.TrimSuffix(param, "_id") + if strings.Contains(paramBase, entityBase) || strings.Contains(entityBase, paramBase) { + return param, true + } + } + } + } + + if allParams["id"] { + return "id", true + } + + if len(allParams) == 1 && (hasID || hasSlug) { + for param := range allParams { + return param, true + } + } + + return "", false +} + +func mapsToEntityID(paramName, entityName string) bool { + entityBase := strings.TrimSuffix(entityName, "Entity") + + expectedParam := toSnakeCase(entityBase) + "_id" + + return strings.EqualFold(paramName, expectedParam) +} + +func isEntityID(paramName string) bool { + return strings.HasSuffix(strings.ToLower(paramName), "_id") || strings.ToLower(paramName) == "id" +}